Lines Matching +full:battery +full:- +full:profile

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>
85 {0, 0x90, "D-PadUp"},
86 {0, 0x91, "D-PadDown"},
87 {0, 0x92, "D-PadRight"},
88 {0, 0x93, "D-PadLeft"},
92 {0, 0xb2, "Anti-Torque"},
147 {0, 0x3B, "Battery Strength"},
392 { 0x84, 0x12, "Battery" },
441 { 0x85, 0, "Battery System" },
468 /* pages 0xff00 to 0xffff are vendor-specific */
469 { 0xffff, 0, "Vendor-specific-FF" },
477 * This is because these functions can be called both for "one-shot"
489 return ERR_PTR(-ENOMEM); in resolv_usage_page()
492 for (p = hid_usage_table; p->description; p++) in resolv_usage_page()
493 if (p->page == page) { in resolv_usage_page()
496 p->description); in resolv_usage_page()
500 seq_printf(f, "%s", p->description); in resolv_usage_page()
525 len += scnprintf(buf + len, HID_DEBUG_BUFSIZE - len, "."); in hid_resolv_usage()
530 for (p = hid_usage_table; p->description; p++) in hid_resolv_usage()
531 if (p->page == (usage >> 16)) { in hid_resolv_usage()
532 for(++p; p->description && p->usage != 0; p++) in hid_resolv_usage()
533 if (p->usage == (usage & 0xffff)) { in hid_resolv_usage()
536 HID_DEBUG_BUFSIZE - len, in hid_resolv_usage()
537 "%s", p->description); in hid_resolv_usage()
541 p->description); in hid_resolv_usage()
547 snprintf(buf + len, HID_DEBUG_BUFSIZE - len, "%04x", in hid_resolv_usage()
562 if (field->physical) { in hid_dump_field()
565 hid_resolv_usage(field->physical, f); seq_printf(f, ")\n"); in hid_dump_field()
567 if (field->logical) { in hid_dump_field()
570 hid_resolv_usage(field->logical, f); seq_printf(f, ")\n"); in hid_dump_field()
572 if (field->application) { in hid_dump_field()
575 hid_resolv_usage(field->application, f); seq_printf(f, ")\n"); in hid_dump_field()
577 tab(n, f); seq_printf(f, "Usage(%d)\n", field->maxusage); in hid_dump_field()
578 for (j = 0; j < field->maxusage; j++) { in hid_dump_field()
579 tab(n+2, f); hid_resolv_usage(field->usage[j].hid, f); seq_printf(f, "\n"); in hid_dump_field()
581 if (field->logical_minimum != field->logical_maximum) { in hid_dump_field()
582 tab(n, f); seq_printf(f, "Logical Minimum(%d)\n", field->logical_minimum); in hid_dump_field()
583 tab(n, f); seq_printf(f, "Logical Maximum(%d)\n", field->logical_maximum); in hid_dump_field()
585 if (field->physical_minimum != field->physical_maximum) { in hid_dump_field()
586 tab(n, f); seq_printf(f, "Physical Minimum(%d)\n", field->physical_minimum); in hid_dump_field()
587 tab(n, f); seq_printf(f, "Physical Maximum(%d)\n", field->physical_maximum); in hid_dump_field()
589 if (field->unit_exponent) { in hid_dump_field()
590 tab(n, f); seq_printf(f, "Unit Exponent(%d)\n", field->unit_exponent); in hid_dump_field()
592 if (field->unit) { in hid_dump_field()
604 __u32 data = field->unit; in hid_dump_field()
630 val = -((0x7 & ~val) +1); in hid_dump_field()
638 tab(n, f); seq_printf(f, "Report Size(%u)\n", field->report_size); in hid_dump_field()
639 tab(n, f); seq_printf(f, "Report Count(%u)\n", field->report_count); in hid_dump_field()
640 tab(n, f); seq_printf(f, "Report Offset(%u)\n", field->report_offset); in hid_dump_field()
643 j = field->flags; in hid_dump_field()
666 report_enum = device->report_enum + i; in hid_dump_device()
667 list = report_enum->report_list.next; in hid_dump_device()
668 while (list != &report_enum->report_list) { in hid_dump_device()
672 if (report->id) in hid_dump_device()
673 seq_printf(f, "(%d)", report->id); in hid_dump_device()
674 seq_printf(f, "[%s]", table[report->type]); in hid_dump_device()
676 for (k = 0; k < report->maxfield; k++) { in hid_dump_device()
679 hid_dump_field(report->field[k], 6, f); in hid_dump_device()
681 list = list->next; in hid_dump_device()
693 spin_lock_irqsave(&hdev->debug_list_lock, flags); in hid_debug_event()
694 list_for_each_entry(list, &hdev->debug_list, node) in hid_debug_event()
695 kfifo_in(&list->hid_debug_fifo, buf, strlen(buf)); in hid_debug_event()
696 spin_unlock_irqrestore(&hdev->debug_list_lock, flags); in hid_debug_event()
698 wake_up_interruptible(&hdev->debug_wait); in hid_debug_event()
714 report_enum = hid->report_enum + type; in hid_dump_report()
717 snprintf(buf, HID_DEBUG_BUFSIZE - 1, in hid_dump_report()
719 report_enum->numbered ? "" : "un"); in hid_dump_report()
723 snprintf(buf, HID_DEBUG_BUFSIZE - 1, in hid_dump_report()
737 buf = hid_resolv_usage(usage->hid, NULL); in hid_dump_input()
741 snprintf(buf + len, HID_DEBUG_BUFSIZE - len - 1, " = %d\n", value); in hid_dump_input()
746 wake_up_interruptible(&hdev->debug_wait); in hid_dump_input()
837 [KEY_DELETEFILE] = "DeleteFile", [KEY_XFER] = "X-fer",
1021 [ABS_VOLUME] = "Volume", [ABS_PROFILE] = "Profile",
1076 list_for_each_entry(report, &hid->report_enum[k].report_list, list) { in hid_dump_input_mapping()
1077 for (i = 0; i < report->maxfield; i++) { in hid_dump_input_mapping()
1078 for ( j = 0; j < report->field[i]->maxusage; j++) { in hid_dump_input_mapping()
1079 usage = report->field[i]->usage + j; in hid_dump_input_mapping()
1080 hid_resolv_usage(usage->hid, f); in hid_dump_input_mapping()
1081 seq_printf(f, " ---> "); in hid_dump_input_mapping()
1082 hid_resolv_event(usage->type, usage->code, f); in hid_dump_input_mapping()
1093 struct hid_device *hdev = f->private; in hid_debug_rdesc_show()
1094 const __u8 *rdesc = hdev->rdesc; in hid_debug_rdesc_show()
1095 unsigned rsize = hdev->rsize; in hid_debug_rdesc_show()
1099 rdesc = hdev->dev_rdesc; in hid_debug_rdesc_show()
1100 rsize = hdev->dev_rsize; in hid_debug_rdesc_show()
1109 if (down_interruptible(&hdev->driver_input_lock)) in hid_debug_rdesc_show()
1116 up(&hdev->driver_input_lock); in hid_debug_rdesc_show()
1128 err = -ENOMEM; in hid_debug_events_open()
1132 err = kfifo_alloc(&list->hid_debug_fifo, HID_DEBUG_FIFOSIZE, GFP_KERNEL); in hid_debug_events_open()
1137 list->hdev = (struct hid_device *) inode->i_private; in hid_debug_events_open()
1138 file->private_data = list; in hid_debug_events_open()
1139 mutex_init(&list->read_mutex); in hid_debug_events_open()
1141 spin_lock_irqsave(&list->hdev->debug_list_lock, flags); in hid_debug_events_open()
1142 list_add_tail(&list->node, &list->hdev->debug_list); in hid_debug_events_open()
1143 spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); in hid_debug_events_open()
1152 struct hid_debug_list *list = file->private_data; in hid_debug_events_read()
1156 mutex_lock(&list->read_mutex); in hid_debug_events_read()
1157 if (kfifo_is_empty(&list->hid_debug_fifo)) { in hid_debug_events_read()
1158 add_wait_queue(&list->hdev->debug_wait, &wait); in hid_debug_events_read()
1161 while (kfifo_is_empty(&list->hid_debug_fifo)) { in hid_debug_events_read()
1163 ret = -ERESTARTSYS; in hid_debug_events_read()
1167 /* if list->hdev is NULL we cannot remove_wait_queue(). in hid_debug_events_read()
1168 * if list->hdev->debug is 0 then hid_debug_unregister() in hid_debug_events_read()
1169 * was already called and list->hdev is being destroyed. in hid_debug_events_read()
1172 if (!list->hdev || !list->hdev->debug) { in hid_debug_events_read()
1173 ret = -EIO; in hid_debug_events_read()
1178 if (file->f_flags & O_NONBLOCK) { in hid_debug_events_read()
1179 ret = -EAGAIN; in hid_debug_events_read()
1184 mutex_unlock(&list->read_mutex); in hid_debug_events_read()
1186 mutex_lock(&list->read_mutex); in hid_debug_events_read()
1191 remove_wait_queue(&list->hdev->debug_wait, &wait); in hid_debug_events_read()
1200 ret = kfifo_to_user(&list->hid_debug_fifo, buffer, count, &copied); in hid_debug_events_read()
1205 mutex_unlock(&list->read_mutex); in hid_debug_events_read()
1211 struct hid_debug_list *list = file->private_data; in hid_debug_events_poll()
1213 poll_wait(file, &list->hdev->debug_wait, wait); in hid_debug_events_poll()
1214 if (!kfifo_is_empty(&list->hid_debug_fifo)) in hid_debug_events_poll()
1216 if (!list->hdev->debug) in hid_debug_events_poll()
1223 struct hid_debug_list *list = file->private_data; in hid_debug_events_release()
1226 spin_lock_irqsave(&list->hdev->debug_list_lock, flags); in hid_debug_events_release()
1227 list_del(&list->node); in hid_debug_events_release()
1228 spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); in hid_debug_events_release()
1229 kfifo_free(&list->hid_debug_fifo); in hid_debug_events_release()
1249 hdev->debug_dir = debugfs_create_dir(name, hid_debug_root); in hid_debug_register()
1250 hdev->debug_rdesc = debugfs_create_file("rdesc", 0400, in hid_debug_register()
1251 hdev->debug_dir, hdev, &hid_debug_rdesc_fops); in hid_debug_register()
1252 hdev->debug_events = debugfs_create_file("events", 0400, in hid_debug_register()
1253 hdev->debug_dir, hdev, &hid_debug_events_fops); in hid_debug_register()
1254 hdev->debug = 1; in hid_debug_register()
1259 hdev->debug = 0; in hid_debug_unregister()
1260 wake_up_interruptible(&hdev->debug_wait); in hid_debug_unregister()
1261 debugfs_remove(hdev->debug_rdesc); in hid_debug_unregister()
1262 debugfs_remove(hdev->debug_events); in hid_debug_unregister()
1263 debugfs_remove(hdev->debug_dir); in hid_debug_unregister()