Lines Matching +full:9 +full:- +full:inch
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>
245 { 0x04, 0x0059, "9Iron" },
255 { 0x04, 0x0063, "9Wood" },
2839 /* pages 0xff00 to 0xffff are vendor-specific */
2840 { 0xffff, 0, "Vendor-specific-FF" },
2848 * This is because these functions can be called both for "one-shot"
2860 return ERR_PTR(-ENOMEM); in resolv_usage_page()
2863 for (p = hid_usage_table; p->description; p++) in resolv_usage_page()
2864 if (p->page == page) { in resolv_usage_page()
2867 p->description); in resolv_usage_page()
2871 seq_printf(f, "%s", p->description); in resolv_usage_page()
2900 len += scnprintf(buf + len, HID_DEBUG_BUFSIZE - len, "."); in hid_resolv_usage()
2905 for (p = hid_usage_table; p->description; p++) in hid_resolv_usage()
2906 if (p->page == (usage >> 16)) { in hid_resolv_usage()
2907 if (p->page == 0x20 && usage_modifier) { in hid_resolv_usage()
2908 for (m = p; m->description; m++) { in hid_resolv_usage()
2909 if (p->page == m->page && m->usage in hid_resolv_usage()
2911 modifier = m->description; in hid_resolv_usage()
2922 for(++p; p->description && p->usage != 0; p++) in hid_resolv_usage()
2923 if (p->usage == usage_actual) { in hid_resolv_usage()
2926 HID_DEBUG_BUFSIZE - len, in hid_resolv_usage()
2927 "%s%s", p->description, in hid_resolv_usage()
2932 p->description, in hid_resolv_usage()
2939 snprintf(buf + len, HID_DEBUG_BUFSIZE - len, "%04x", in hid_resolv_usage()
2954 if (field->physical) { in hid_dump_field()
2957 hid_resolv_usage(field->physical, f); seq_printf(f, ")\n"); in hid_dump_field()
2959 if (field->logical) { in hid_dump_field()
2962 hid_resolv_usage(field->logical, f); seq_printf(f, ")\n"); in hid_dump_field()
2964 if (field->application) { in hid_dump_field()
2967 hid_resolv_usage(field->application, f); seq_printf(f, ")\n"); in hid_dump_field()
2969 tab(n, f); seq_printf(f, "Usage(%d)\n", field->maxusage); in hid_dump_field()
2970 for (j = 0; j < field->maxusage; j++) { in hid_dump_field()
2971 tab(n+2, f); hid_resolv_usage(field->usage[j].hid, f); seq_printf(f, "\n"); in hid_dump_field()
2973 if (field->logical_minimum != field->logical_maximum) { in hid_dump_field()
2974 tab(n, f); seq_printf(f, "Logical Minimum(%d)\n", field->logical_minimum); in hid_dump_field()
2975 tab(n, f); seq_printf(f, "Logical Maximum(%d)\n", field->logical_maximum); in hid_dump_field()
2977 if (field->physical_minimum != field->physical_maximum) { in hid_dump_field()
2978 tab(n, f); seq_printf(f, "Physical Minimum(%d)\n", field->physical_minimum); in hid_dump_field()
2979 tab(n, f); seq_printf(f, "Physical Maximum(%d)\n", field->physical_maximum); in hid_dump_field()
2981 if (field->unit_exponent) { in hid_dump_field()
2982 tab(n, f); seq_printf(f, "Unit Exponent(%d)\n", field->unit_exponent); in hid_dump_field()
2984 if (field->unit) { in hid_dump_field()
2990 { "None", "Inch", "Slug", "Seconds", "Fahrenheit", "Ampere", "Candela", "None" }, in hid_dump_field()
2996 __u32 data = field->unit; in hid_dump_field()
3022 val = -((0x7 & ~val) +1); in hid_dump_field()
3030 tab(n, f); seq_printf(f, "Report Size(%u)\n", field->report_size); in hid_dump_field()
3031 tab(n, f); seq_printf(f, "Report Count(%u)\n", field->report_count); in hid_dump_field()
3032 tab(n, f); seq_printf(f, "Report Offset(%u)\n", field->report_offset); in hid_dump_field()
3035 j = field->flags; in hid_dump_field()
3058 report_enum = device->report_enum + i; in hid_dump_device()
3059 list = report_enum->report_list.next; in hid_dump_device()
3060 while (list != &report_enum->report_list) { in hid_dump_device()
3064 if (report->id) in hid_dump_device()
3065 seq_printf(f, "(%d)", report->id); in hid_dump_device()
3066 seq_printf(f, "[%s]", table[report->type]); in hid_dump_device()
3068 for (k = 0; k < report->maxfield; k++) { in hid_dump_device()
3071 hid_dump_field(report->field[k], 6, f); in hid_dump_device()
3073 list = list->next; in hid_dump_device()
3085 spin_lock_irqsave(&hdev->debug_list_lock, flags); in hid_debug_event()
3086 list_for_each_entry(list, &hdev->debug_list, node) in hid_debug_event()
3087 kfifo_in(&list->hid_debug_fifo, buf, strlen(buf)); in hid_debug_event()
3088 spin_unlock_irqrestore(&hdev->debug_list_lock, flags); in hid_debug_event()
3090 wake_up_interruptible(&hdev->debug_wait); in hid_debug_event()
3106 report_enum = hid->report_enum + type; in hid_dump_report()
3109 snprintf(buf, HID_DEBUG_BUFSIZE - 1, in hid_dump_report()
3111 report_enum->numbered ? "" : "un"); in hid_dump_report()
3115 snprintf(buf, HID_DEBUG_BUFSIZE - 1, in hid_dump_report()
3129 buf = hid_resolv_usage(usage->hid, NULL); in hid_dump_input()
3133 snprintf(buf + len, HID_DEBUG_BUFSIZE - len - 1, " = %d\n", value); in hid_dump_input()
3138 wake_up_interruptible(&hdev->debug_wait); in hid_dump_input()
3162 [KEY_9] = "9", [KEY_0] = "0",
3229 [KEY_DELETEFILE] = "DeleteFile", [KEY_XFER] = "X-fer",
3631 list_for_each_entry(report, &hid->report_enum[k].report_list, list) { in hid_dump_input_mapping()
3632 for (i = 0; i < report->maxfield; i++) { in hid_dump_input_mapping()
3633 for ( j = 0; j < report->field[i]->maxusage; j++) { in hid_dump_input_mapping()
3634 usage = report->field[i]->usage + j; in hid_dump_input_mapping()
3635 hid_resolv_usage(usage->hid, f); in hid_dump_input_mapping()
3636 seq_printf(f, " ---> "); in hid_dump_input_mapping()
3637 hid_resolv_event(usage->type, usage->code, f); in hid_dump_input_mapping()
3648 struct hid_device *hdev = f->private; in hid_debug_rdesc_show()
3649 const __u8 *rdesc = hdev->rdesc; in hid_debug_rdesc_show()
3650 unsigned rsize = hdev->rsize; in hid_debug_rdesc_show()
3654 rdesc = hdev->dev_rdesc; in hid_debug_rdesc_show()
3655 rsize = hdev->dev_rsize; in hid_debug_rdesc_show()
3664 if (down_interruptible(&hdev->driver_input_lock)) in hid_debug_rdesc_show()
3671 up(&hdev->driver_input_lock); in hid_debug_rdesc_show()
3683 err = -ENOMEM; in hid_debug_events_open()
3687 err = kfifo_alloc(&list->hid_debug_fifo, HID_DEBUG_FIFOSIZE, GFP_KERNEL); in hid_debug_events_open()
3692 list->hdev = (struct hid_device *) inode->i_private; in hid_debug_events_open()
3693 kref_get(&list->hdev->ref); in hid_debug_events_open()
3694 file->private_data = list; in hid_debug_events_open()
3695 mutex_init(&list->read_mutex); in hid_debug_events_open()
3697 spin_lock_irqsave(&list->hdev->debug_list_lock, flags); in hid_debug_events_open()
3698 list_add_tail(&list->node, &list->hdev->debug_list); in hid_debug_events_open()
3699 spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); in hid_debug_events_open()
3708 struct hid_debug_list *list = file->private_data; in hid_debug_events_read()
3712 mutex_lock(&list->read_mutex); in hid_debug_events_read()
3713 if (kfifo_is_empty(&list->hid_debug_fifo)) { in hid_debug_events_read()
3714 add_wait_queue(&list->hdev->debug_wait, &wait); in hid_debug_events_read()
3717 while (kfifo_is_empty(&list->hid_debug_fifo)) { in hid_debug_events_read()
3719 ret = -ERESTARTSYS; in hid_debug_events_read()
3723 /* if list->hdev is NULL we cannot remove_wait_queue(). in hid_debug_events_read()
3724 * if list->hdev->debug is 0 then hid_debug_unregister() in hid_debug_events_read()
3725 * was already called and list->hdev is being destroyed. in hid_debug_events_read()
3728 if (!list->hdev || !list->hdev->debug) { in hid_debug_events_read()
3729 ret = -EIO; in hid_debug_events_read()
3734 if (file->f_flags & O_NONBLOCK) { in hid_debug_events_read()
3735 ret = -EAGAIN; in hid_debug_events_read()
3740 mutex_unlock(&list->read_mutex); in hid_debug_events_read()
3742 mutex_lock(&list->read_mutex); in hid_debug_events_read()
3747 remove_wait_queue(&list->hdev->debug_wait, &wait); in hid_debug_events_read()
3756 ret = kfifo_to_user(&list->hid_debug_fifo, buffer, count, &copied); in hid_debug_events_read()
3761 mutex_unlock(&list->read_mutex); in hid_debug_events_read()
3767 struct hid_debug_list *list = file->private_data; in hid_debug_events_poll()
3769 poll_wait(file, &list->hdev->debug_wait, wait); in hid_debug_events_poll()
3770 if (!kfifo_is_empty(&list->hid_debug_fifo)) in hid_debug_events_poll()
3772 if (!list->hdev->debug) in hid_debug_events_poll()
3779 struct hid_debug_list *list = file->private_data; in hid_debug_events_release()
3782 spin_lock_irqsave(&list->hdev->debug_list_lock, flags); in hid_debug_events_release()
3783 list_del(&list->node); in hid_debug_events_release()
3784 spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); in hid_debug_events_release()
3785 kfifo_free(&list->hid_debug_fifo); in hid_debug_events_release()
3787 kref_put(&list->hdev->ref, hiddev_free); in hid_debug_events_release()
3807 hdev->debug_dir = debugfs_create_dir(name, hid_debug_root); in hid_debug_register()
3808 hdev->debug_rdesc = debugfs_create_file("rdesc", 0400, in hid_debug_register()
3809 hdev->debug_dir, hdev, &hid_debug_rdesc_fops); in hid_debug_register()
3810 hdev->debug_events = debugfs_create_file("events", 0400, in hid_debug_register()
3811 hdev->debug_dir, hdev, &hid_debug_events_fops); in hid_debug_register()
3812 hdev->debug = 1; in hid_debug_register()
3817 hdev->debug = 0; in hid_debug_unregister()
3818 wake_up_interruptible(&hdev->debug_wait); in hid_debug_unregister()
3819 debugfs_remove(hdev->debug_rdesc); in hid_debug_unregister()
3820 debugfs_remove(hdev->debug_events); in hid_debug_unregister()
3821 debugfs_remove(hdev->debug_dir); in hid_debug_unregister()