Lines Matching +full:test +full:- +full:tab

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de>
4 * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz>
5 * (c) 2007-2009 Jiri Kosina
13 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
29 #include <linux/hid-debug.h>
2437 { 0x84, 0x0058, "Test" },
2842 /* pages 0xff00 to 0xffff are vendor-specific */
2843 { 0xffff, 0, "Vendor-specific-FF" },
2851 * This is because these functions can be called both for "one-shot"
2863 return ERR_PTR(-ENOMEM); in resolv_usage_page()
2866 for (p = hid_usage_table; p->description; p++) in resolv_usage_page()
2867 if (p->page == page) { in resolv_usage_page()
2870 p->description); in resolv_usage_page()
2874 seq_printf(f, "%s", p->description); in resolv_usage_page()
2903 len += scnprintf(buf + len, HID_DEBUG_BUFSIZE - len, "."); in hid_resolv_usage()
2908 for (p = hid_usage_table; p->description; p++) in hid_resolv_usage()
2909 if (p->page == (usage >> 16)) { in hid_resolv_usage()
2910 if (p->page == 0x20 && usage_modifier) { in hid_resolv_usage()
2911 for (m = p; m->description; m++) { in hid_resolv_usage()
2912 if (p->page == m->page && m->usage in hid_resolv_usage()
2914 modifier = m->description; in hid_resolv_usage()
2925 for(++p; p->description && p->usage != 0; p++) in hid_resolv_usage()
2926 if (p->usage == usage_actual) { in hid_resolv_usage()
2929 HID_DEBUG_BUFSIZE - len, in hid_resolv_usage()
2930 "%s%s", p->description, in hid_resolv_usage()
2935 p->description, in hid_resolv_usage()
2942 snprintf(buf + len, HID_DEBUG_BUFSIZE - len, "%04x", in hid_resolv_usage()
2950 static void tab(int n, struct seq_file *f) { in tab() function
2957 if (field->physical) { in hid_dump_field()
2958 tab(n, f); in hid_dump_field()
2960 hid_resolv_usage(field->physical, f); seq_printf(f, ")\n"); in hid_dump_field()
2962 if (field->logical) { in hid_dump_field()
2963 tab(n, f); in hid_dump_field()
2965 hid_resolv_usage(field->logical, f); seq_printf(f, ")\n"); in hid_dump_field()
2967 if (field->application) { in hid_dump_field()
2968 tab(n, f); in hid_dump_field()
2970 hid_resolv_usage(field->application, f); seq_printf(f, ")\n"); in hid_dump_field()
2972 tab(n, f); seq_printf(f, "Usage(%d)\n", field->maxusage); in hid_dump_field()
2973 for (j = 0; j < field->maxusage; j++) { in hid_dump_field()
2974 tab(n+2, f); hid_resolv_usage(field->usage[j].hid, f); seq_printf(f, "\n"); in hid_dump_field()
2976 if (field->logical_minimum != field->logical_maximum) { in hid_dump_field()
2977 tab(n, f); seq_printf(f, "Logical Minimum(%d)\n", field->logical_minimum); in hid_dump_field()
2978 tab(n, f); seq_printf(f, "Logical Maximum(%d)\n", field->logical_maximum); in hid_dump_field()
2980 if (field->physical_minimum != field->physical_maximum) { in hid_dump_field()
2981 tab(n, f); seq_printf(f, "Physical Minimum(%d)\n", field->physical_minimum); in hid_dump_field()
2982 tab(n, f); seq_printf(f, "Physical Maximum(%d)\n", field->physical_maximum); in hid_dump_field()
2984 if (field->unit_exponent) { in hid_dump_field()
2985 tab(n, f); seq_printf(f, "Unit Exponent(%d)\n", field->unit_exponent); in hid_dump_field()
2987 if (field->unit) { in hid_dump_field()
2999 __u32 data = field->unit; in hid_dump_field()
3006 tab(n, f); seq_printf(f, "Unit(Invalid)\n"); in hid_dump_field()
3011 tab(n, f); seq_printf(f, "Unit(%s : ", systems[sys]); in hid_dump_field()
3025 val = -((0x7 & ~val) +1); in hid_dump_field()
3033 tab(n, f); seq_printf(f, "Report Size(%u)\n", field->report_size); in hid_dump_field()
3034 tab(n, f); seq_printf(f, "Report Count(%u)\n", field->report_count); in hid_dump_field()
3035 tab(n, f); seq_printf(f, "Report Offset(%u)\n", field->report_offset); in hid_dump_field()
3037 tab(n, f); seq_printf(f, "Flags( "); in hid_dump_field()
3038 j = field->flags; in hid_dump_field()
3061 report_enum = device->report_enum + i; in hid_dump_device()
3062 list = report_enum->report_list.next; in hid_dump_device()
3063 while (list != &report_enum->report_list) { in hid_dump_device()
3065 tab(2, f); in hid_dump_device()
3067 if (report->id) in hid_dump_device()
3068 seq_printf(f, "(%d)", report->id); in hid_dump_device()
3069 seq_printf(f, "[%s]", table[report->type]); in hid_dump_device()
3071 for (k = 0; k < report->maxfield; k++) { in hid_dump_device()
3072 tab(4, f); in hid_dump_device()
3074 hid_dump_field(report->field[k], 6, f); in hid_dump_device()
3076 list = list->next; in hid_dump_device()
3088 spin_lock_irqsave(&hdev->debug_list_lock, flags); in hid_debug_event()
3089 list_for_each_entry(list, &hdev->debug_list, node) in hid_debug_event()
3090 kfifo_in(&list->hid_debug_fifo, buf, strlen(buf)); in hid_debug_event()
3091 spin_unlock_irqrestore(&hdev->debug_list_lock, flags); in hid_debug_event()
3093 wake_up_interruptible(&hdev->debug_wait); in hid_debug_event()
3109 report_enum = hid->report_enum + type; in hid_dump_report()
3112 snprintf(buf, HID_DEBUG_BUFSIZE - 1, in hid_dump_report()
3114 report_enum->numbered ? "" : "un"); in hid_dump_report()
3118 snprintf(buf, HID_DEBUG_BUFSIZE - 1, in hid_dump_report()
3132 buf = hid_resolv_usage(usage->hid, NULL); in hid_dump_input()
3136 snprintf(buf + len, HID_DEBUG_BUFSIZE - len - 1, " = %d\n", value); in hid_dump_input()
3141 wake_up_interruptible(&hdev->debug_wait); in hid_dump_input()
3167 [KEY_BACKSPACE] = "Backspace", [KEY_TAB] = "Tab",
3232 [KEY_DELETEFILE] = "DeleteFile", [KEY_XFER] = "X-fer",
3639 list_for_each_entry(report, &hid->report_enum[k].report_list, list) { in hid_dump_input_mapping()
3640 for (i = 0; i < report->maxfield; i++) { in hid_dump_input_mapping()
3641 for ( j = 0; j < report->field[i]->maxusage; j++) { in hid_dump_input_mapping()
3642 usage = report->field[i]->usage + j; in hid_dump_input_mapping()
3643 hid_resolv_usage(usage->hid, f); in hid_dump_input_mapping()
3644 seq_printf(f, " ---> "); in hid_dump_input_mapping()
3645 hid_resolv_event(usage->type, usage->code, f); in hid_dump_input_mapping()
3656 struct hid_device *hdev = f->private; in hid_debug_rdesc_show()
3657 const __u8 *rdesc = hdev->rdesc; in hid_debug_rdesc_show()
3658 unsigned rsize = hdev->rsize; in hid_debug_rdesc_show()
3662 rdesc = hdev->dev_rdesc; in hid_debug_rdesc_show()
3663 rsize = hdev->dev_rsize; in hid_debug_rdesc_show()
3672 if (down_interruptible(&hdev->driver_input_lock)) in hid_debug_rdesc_show()
3679 up(&hdev->driver_input_lock); in hid_debug_rdesc_show()
3691 err = -ENOMEM; in hid_debug_events_open()
3695 err = kfifo_alloc(&list->hid_debug_fifo, HID_DEBUG_FIFOSIZE, GFP_KERNEL); in hid_debug_events_open()
3700 list->hdev = (struct hid_device *) inode->i_private; in hid_debug_events_open()
3701 kref_get(&list->hdev->ref); in hid_debug_events_open()
3702 file->private_data = list; in hid_debug_events_open()
3703 mutex_init(&list->read_mutex); in hid_debug_events_open()
3705 spin_lock_irqsave(&list->hdev->debug_list_lock, flags); in hid_debug_events_open()
3706 list_add_tail(&list->node, &list->hdev->debug_list); in hid_debug_events_open()
3707 spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); in hid_debug_events_open()
3716 struct hid_debug_list *list = file->private_data; in hid_debug_events_read()
3720 mutex_lock(&list->read_mutex); in hid_debug_events_read()
3721 if (kfifo_is_empty(&list->hid_debug_fifo)) { in hid_debug_events_read()
3722 add_wait_queue(&list->hdev->debug_wait, &wait); in hid_debug_events_read()
3725 while (kfifo_is_empty(&list->hid_debug_fifo)) { in hid_debug_events_read()
3727 ret = -ERESTARTSYS; in hid_debug_events_read()
3731 /* if list->hdev is NULL we cannot remove_wait_queue(). in hid_debug_events_read()
3732 * if list->hdev->debug is 0 then hid_debug_unregister() in hid_debug_events_read()
3733 * was already called and list->hdev is being destroyed. in hid_debug_events_read()
3736 if (!list->hdev || !list->hdev->debug) { in hid_debug_events_read()
3737 ret = -EIO; in hid_debug_events_read()
3742 if (file->f_flags & O_NONBLOCK) { in hid_debug_events_read()
3743 ret = -EAGAIN; in hid_debug_events_read()
3748 mutex_unlock(&list->read_mutex); in hid_debug_events_read()
3750 mutex_lock(&list->read_mutex); in hid_debug_events_read()
3755 remove_wait_queue(&list->hdev->debug_wait, &wait); in hid_debug_events_read()
3764 ret = kfifo_to_user(&list->hid_debug_fifo, buffer, count, &copied); in hid_debug_events_read()
3769 mutex_unlock(&list->read_mutex); in hid_debug_events_read()
3775 struct hid_debug_list *list = file->private_data; in hid_debug_events_poll()
3777 poll_wait(file, &list->hdev->debug_wait, wait); in hid_debug_events_poll()
3778 if (!kfifo_is_empty(&list->hid_debug_fifo)) in hid_debug_events_poll()
3780 if (!list->hdev->debug) in hid_debug_events_poll()
3787 struct hid_debug_list *list = file->private_data; in hid_debug_events_release()
3790 spin_lock_irqsave(&list->hdev->debug_list_lock, flags); in hid_debug_events_release()
3791 list_del(&list->node); in hid_debug_events_release()
3792 spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); in hid_debug_events_release()
3793 kfifo_free(&list->hid_debug_fifo); in hid_debug_events_release()
3795 kref_put(&list->hdev->ref, hiddev_free); in hid_debug_events_release()
3815 hdev->debug_dir = debugfs_create_dir(name, hid_debug_root); in hid_debug_register()
3816 hdev->debug_rdesc = debugfs_create_file("rdesc", 0400, in hid_debug_register()
3817 hdev->debug_dir, hdev, &hid_debug_rdesc_fops); in hid_debug_register()
3818 hdev->debug_events = debugfs_create_file("events", 0400, in hid_debug_register()
3819 hdev->debug_dir, hdev, &hid_debug_events_fops); in hid_debug_register()
3820 hdev->debug = 1; in hid_debug_register()
3825 hdev->debug = 0; in hid_debug_unregister()
3826 wake_up_interruptible(&hdev->debug_wait); in hid_debug_unregister()
3827 debugfs_remove(hdev->debug_rdesc); in hid_debug_unregister()
3828 debugfs_remove(hdev->debug_events); in hid_debug_unregister()
3829 debugfs_remove(hdev->debug_dir); in hid_debug_unregister()