Changes in / [14e1bcc:3e6e2b9] in mainline
- Location:
- uspace
- Files:
-
- 2 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkbd/Makefile
r14e1bcc r3e6e2b9 31 31 32 32 LIBS = \ 33 $(LIBUSBHID_PREFIX)/libusbhid.a \ 33 34 $(LIBUSBDEV_PREFIX)/libusbdev.a \ 34 35 $(LIBUSB_PREFIX)/libusb.a \ 35 $(LIBDRV_PREFIX)/libdrv.a 36 $(LIBDRV_PREFIX)/libdrv.a 36 37 EXTRA_CFLAGS = \ 37 38 -I$(LIBUSB_PREFIX)/include \ 38 39 -I$(LIBUSBDEV_PREFIX)/include \ 39 -I$(LIBDRV_PREFIX)/include 40 -I$(LIBDRV_PREFIX)/include \ 41 -I$(LIBUSBHID_PREFIX)/include 40 42 41 43 SOURCES = \ -
uspace/app/mkbd/main.c
r14e1bcc r3e6e2b9 45 45 #include <devmap.h> 46 46 #include <usb/dev/hub.h> 47 #include <usb/hc.h> 47 //#include <usb/host.h> 48 //#include <usb/driver.h> 49 #include <usb/hid/iface.h> 48 50 #include <usb/dev/pipes.h> 51 #include <async.h> 52 #include <usb/hid/usages/core.h> 53 #include <usb/hid/hidparser.h> 54 #include <usb/hid/hiddescriptor.h> 55 #include <usb/hid/usages/consumer.h> 56 #include <assert.h> 49 57 50 58 #define NAME "mkbd" … … 52 60 static int dev_phone = -1; 53 61 54 //static void print_found_hc(size_t class_index, const char *path) 55 //{ 56 // // printf(NAME ": host controller %zu is `%s'.\n", class_index, path); 57 // printf("Bus %02zu: %s\n", class_index, path); 58 //} 59 //static void print_found_dev(usb_address_t addr, const char *path) 60 //{ 61 // // printf(NAME ": device with address %d is `%s'.\n", addr, path); 62 // printf(" Device %02d: %s\n", addr, path); 63 //} 64 65 //static void print_hc_devices(devman_handle_t hc_handle) 66 //{ 67 // int rc; 68 // usb_hc_connection_t conn; 69 70 // usb_hc_connection_initialize(&conn, hc_handle); 71 // rc = usb_hc_connection_open(&conn); 72 // if (rc != EOK) { 73 // printf(NAME ": failed to connect to HC: %s.\n", 74 // str_error(rc)); 75 // return; 76 // } 77 // usb_address_t addr; 78 // for (addr = 1; addr < 5; addr++) { 79 // devman_handle_t dev_handle; 80 // rc = usb_hc_get_handle_by_address(&conn, addr, &dev_handle); 81 // if (rc != EOK) { 82 // continue; 83 // } 84 // char path[MAX_PATH_LENGTH]; 85 // rc = devman_get_device_path(dev_handle, path, MAX_PATH_LENGTH); 86 // if (rc != EOK) { 87 // continue; 88 // } 89 // print_found_dev(addr, path); 90 // } 91 // usb_hc_connection_close(&conn); 92 //} 93 94 static bool try_parse_class_and_address(const char *path, 95 devman_handle_t *out_hc_handle, usb_address_t *out_device_address) 96 { 97 size_t class_index; 98 size_t address; 99 int rc; 100 char *ptr; 101 102 rc = str_size_t(path, &ptr, 10, false, &class_index); 103 if (rc != EOK) { 104 return false; 105 } 106 if ((*ptr == ':') || (*ptr == '.')) { 107 ptr++; 108 } else { 109 return false; 110 } 111 rc = str_size_t(ptr, NULL, 10, true, &address); 112 if (rc != EOK) { 113 return false; 114 } 115 rc = usb_ddf_get_hc_handle_by_class(class_index, out_hc_handle); 116 if (rc != EOK) { 117 return false; 118 } 119 if (out_device_address != NULL) { 120 *out_device_address = (usb_address_t) address; 121 } 122 return true; 123 } 124 125 static bool resolve_hc_handle_and_dev_addr(const char *devpath, 126 devman_handle_t *out_hc_handle, usb_address_t *out_device_address) 127 { 128 int rc; 129 130 /* Hack for QEMU to save-up on typing ;-). */ 131 if (str_cmp(devpath, "qemu") == 0) { 132 devpath = "/hw/pci0/00:01.2/uhci-rh/usb00_a1"; 133 } 134 135 /* Hack for virtual keyboard. */ 136 if (str_cmp(devpath, "virt") == 0) { 137 devpath = "/virt/usbhc/usb00_a1/usb00_a2"; 138 } 139 140 if (try_parse_class_and_address(devpath, 141 out_hc_handle, out_device_address)) { 142 return true; 143 } 144 145 char *path = str_dup(devpath); 62 static int initialize_report_parser(int dev_phone, usb_hid_report_t **report) 63 { 64 *report = (usb_hid_report_t *)malloc(sizeof(usb_hid_report_t)); 65 if (*report == NULL) { 66 return ENOMEM; 67 } 68 69 int rc = usb_hid_report_init(*report); 70 if (rc != EOK) { 71 usb_hid_free_report(*report); 72 *report = NULL; 73 printf("usb_hid_report_init() failed.\n"); 74 return rc; 75 } 76 77 // get the report descriptor length from the device 78 size_t report_desc_size; 79 rc = usbhid_dev_get_report_descriptor_length( 80 dev_phone, &report_desc_size); 81 if (rc != EOK) { 82 usb_hid_free_report(*report); 83 *report = NULL; 84 printf("usbhid_dev_get_report_descriptor_length() failed.\n"); 85 return rc; 86 } 87 88 if (report_desc_size == 0) { 89 usb_hid_free_report(*report); 90 *report = NULL; 91 printf("usbhid_dev_get_report_descriptor_length() returned 0.\n"); 92 return EINVAL; // TODO: other error code? 93 } 94 95 uint8_t *desc = (uint8_t *)malloc(report_desc_size); 96 if (desc == NULL) { 97 usb_hid_free_report(*report); 98 *report = NULL; 99 return ENOMEM; 100 } 101 102 // get the report descriptor from the device 103 size_t actual_size; 104 rc = usbhid_dev_get_report_descriptor(dev_phone, desc, report_desc_size, 105 &actual_size); 106 if (rc != EOK) { 107 usb_hid_free_report(*report); 108 *report = NULL; 109 free(desc); 110 printf("usbhid_dev_get_report_descriptor() failed.\n"); 111 return rc; 112 } 113 114 if (actual_size != report_desc_size) { 115 usb_hid_free_report(*report); 116 *report = NULL; 117 free(desc); 118 printf("usbhid_dev_get_report_descriptor() returned wrong size:" 119 " %zu, expected: %zu.\n", actual_size, report_desc_size); 120 return EINVAL; // TODO: other error code? 121 } 122 123 // initialize the report parser 124 125 rc = usb_hid_parse_report_descriptor(*report, desc, report_desc_size); 126 free(desc); 127 128 if (rc != EOK) { 129 free(desc); 130 printf("usb_hid_parse_report_descriptor() failed.\n"); 131 return rc; 132 } 133 134 return EOK; 135 } 136 137 static void print_key(uint8_t *buffer, size_t size, usb_hid_report_t *report) 138 { 139 assert(buffer != NULL); 140 assert(report != NULL); 141 142 printf("Calling usb_hid_parse_report() with size %zu and " 143 "buffer: \n", size); 144 for (size_t i = 0; i < size; ++i) { 145 printf(" %X ", buffer[i]); 146 } 147 printf("\n"); 148 149 uint8_t report_id; 150 int rc = usb_hid_parse_report(report, buffer, size, &report_id); 151 if (rc != EOK) { 152 printf("Error parsing report: %s\n", str_error(rc)); 153 return; 154 } 155 156 usb_hid_report_path_t *path = usb_hid_report_path(); 146 157 if (path == NULL) { 147 return ENOMEM; 148 } 149 150 devman_handle_t hc = 0; 151 bool hc_found = false; 152 usb_address_t addr = 0; 153 bool addr_found = false; 154 155 /* Remove suffixes and hope that we will encounter device node. */ 156 while (str_length(path) > 0) { 157 /* Get device handle first. */ 158 devman_handle_t dev_handle; 159 rc = devman_device_get_handle(path, &dev_handle, 0); 160 if (rc != EOK) { 161 free(path); 162 return false; 158 return; 159 } 160 161 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0); 162 163 usb_hid_report_path_set_report_id(path, report_id); 164 165 usb_hid_report_field_t *field = usb_hid_report_get_sibling( 166 report, NULL, path, USB_HID_PATH_COMPARE_END 167 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 168 USB_HID_REPORT_TYPE_INPUT); 169 170 while (field != NULL) { 171 if (field->value != 0) { 172 const char *key_str = 173 usbhid_multimedia_usage_to_str(field->usage); 174 printf("Pressed key: %s\n", key_str); 163 175 } 164 165 /* Try to find its host controller. */ 166 if (!hc_found) { 167 rc = usb_hc_find(dev_handle, &hc); 168 if (rc == EOK) { 169 hc_found = true; 170 } 171 } 172 /* Try to get its address. */ 173 if (!addr_found) { 174 addr = usb_hc_get_address_by_handle(dev_handle); 175 if (addr >= 0) { 176 addr_found = true; 177 } 178 } 179 180 /* Speed-up. */ 181 if (hc_found && addr_found) { 182 break; 183 } 184 185 /* Remove the last suffix. */ 186 char *slash_pos = str_rchr(path, '/'); 187 if (slash_pos != NULL) { 188 *slash_pos = 0; 189 } 190 } 191 192 free(path); 193 194 if (hc_found && addr_found) { 195 if (out_hc_handle != NULL) { 196 *out_hc_handle = hc; 197 } 198 if (out_device_address != NULL) { 199 *out_device_address = addr; 200 } 201 return true; 202 } else { 203 return false; 204 } 205 } 176 177 field = usb_hid_report_get_sibling( 178 report, field, path, USB_HID_PATH_COMPARE_END 179 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 180 USB_HID_REPORT_TYPE_INPUT); 181 } 182 183 usb_hid_report_path_free(path); 184 } 185 186 #define MAX_PATH_LENGTH 1024 206 187 207 188 static void print_usage(char *app_name) … … 209 190 #define _INDENT " " 210 191 211 212 213 192 printf(NAME ": Print out what multimedia keys were pressed.\n\n"); 193 printf("Usage: %s device\n", app_name); 194 printf(_INDENT "The device is a devman path to the device.\n"); 214 195 215 196 #undef _OPTION … … 225 206 } 226 207 227 char *devpath = argv[1]; 228 229 /* The initialization is here only to make compiler happy. */ 230 devman_handle_t hc_handle = 0; 231 usb_address_t dev_addr = 0; 232 bool found = resolve_hc_handle_and_dev_addr(devpath, 233 &hc_handle, &dev_addr); 234 if (!found) { 235 fprintf(stderr, NAME ": device `%s' not found " 236 "or not of USB kind. Exiting.\n", devpath); 237 return -1; 238 } 208 //char *devpath = argv[1]; 209 const char *devpath = "/hw/pci0/00:06.0/ohci-rh/usb00_a2/HID1/hid"; 239 210 240 211 int rc; 241 usb_hc_connection_t conn; 242 243 usb_hc_connection_initialize(&conn, hc_handle); 244 rc = usb_hc_connection_open(&conn); 245 if (rc != EOK) { 246 printf(NAME ": failed to connect to HC: %s.\n", 212 213 devman_handle_t dev_handle = 0; 214 rc = devman_device_get_handle(devpath, &dev_handle, 0); 215 if (rc != EOK) { 216 printf("Failed to get handle from devman: %s.\n", 247 217 str_error(rc)); 248 return -1; 249 } 250 usb_address_t addr = 0; 251 252 devman_handle_t dev_handle; 253 rc = usb_hc_get_handle_by_address(&conn, addr, &dev_handle); 254 if (rc != EOK) { 255 printf(NAME ": failed getting handle to the device: %s.\n", 256 str_error(rc)); 257 return -1; 258 } 259 260 usb_hc_connection_close(&conn); 218 return rc; 219 } 261 220 262 221 rc = devman_device_connect(dev_handle, 0); 263 222 if (rc < 0) { 264 printf(NAME ": failed to connect to the device : %s.\n",265 str_error(rc));266 return -1;223 printf(NAME ": failed to connect to the device (handle %" 224 PRIun "): %s.\n", dev_handle, str_error(rc)); 225 return rc; 267 226 } 268 227 … … 270 229 printf("Got phone to the device: %d\n", dev_phone); 271 230 272 273 // size_t class_index = 0; 274 // size_t failed_attempts = 0; 275 276 // while (failed_attempts < MAX_FAILED_ATTEMPTS) { 277 // class_index++; 278 // devman_handle_t hc_handle = 0; 279 // int rc = usb_ddf_get_hc_handle_by_class(class_index, &hc_handle); 280 // if (rc != EOK) { 281 // failed_attempts++; 282 // continue; 283 // } 284 // char path[MAX_PATH_LENGTH]; 285 // rc = devman_get_device_path(hc_handle, path, MAX_PATH_LENGTH); 286 // if (rc != EOK) { 287 // continue; 288 // } 289 // print_found_hc(class_index, path); 290 // print_hc_devices(hc_handle); 291 // } 231 char path[MAX_PATH_LENGTH]; 232 rc = devman_get_device_path(dev_handle, path, MAX_PATH_LENGTH); 233 if (rc != EOK) { 234 return ENOMEM; 235 } 236 237 printf("Device path: %s\n", path); 238 239 240 usb_hid_report_t *report = NULL; 241 rc = initialize_report_parser(dev_phone, &report); 242 if (rc != EOK) { 243 printf("Failed to initialize report parser: %s\n", 244 str_error(rc)); 245 return rc; 246 } 247 248 assert(report != NULL); 249 250 size_t size; 251 rc = usbhid_dev_get_event_length(dev_phone, &size); 252 if (rc != EOK) { 253 printf("Failed to get event length: %s.\n", str_error(rc)); 254 return rc; 255 } 256 257 printf("Event length: %zu\n", size); 258 uint8_t *event = (uint8_t *)malloc(size); 259 if (event == NULL) { 260 // hangup phone? 261 return ENOMEM; 262 } 263 264 printf("Event length: %zu\n", size); 265 266 size_t actual_size; 267 268 while (1) { 269 // get event from the driver 270 printf("Getting event from the driver.\n"); 271 272 /** @todo Try blocking call. */ 273 rc = usbhid_dev_get_event(dev_phone, event, size, &actual_size, 274 0); 275 if (rc != EOK) { 276 // hangup phone? 277 printf("Error in getting event from the HID driver:" 278 "%s.\n", str_error(rc)); 279 break; 280 } 281 282 printf("Got buffer: %p, size: %zu, max size: %zu\n", event, 283 actual_size, size); 284 285 print_key(event, size, report); 286 287 async_usleep(10000); 288 } 292 289 293 290 return 0; -
uspace/drv/usbhid/generic/hiddev.c
r14e1bcc r3e6e2b9 62 62 static size_t usb_generic_hid_get_event_length(ddf_fun_t *fun); 63 63 64 static int usb_generic_hid_get_event(ddf_fun_t *fun, int32_t *buffer,64 static int usb_generic_hid_get_event(ddf_fun_t *fun, uint8_t *buffer, 65 65 size_t size, size_t *act_size, unsigned int flags); 66 66 67 67 static int usb_generic_hid_client_connected(ddf_fun_t *fun); 68 69 static size_t usb_generic_get_report_descriptor_length(ddf_fun_t *fun); 70 71 static int usb_generic_get_report_descriptor(ddf_fun_t *fun, uint8_t *desc, 72 size_t size, size_t *actual_size); 68 73 69 74 /*----------------------------------------------------------------------------*/ … … 71 76 static usbhid_iface_t usb_generic_iface = { 72 77 .get_event = usb_generic_hid_get_event, 73 .get_event_length = usb_generic_hid_get_event_length 78 .get_event_length = usb_generic_hid_get_event_length, 79 .get_report_descriptor_length = usb_generic_get_report_descriptor_length, 80 .get_report_descriptor = usb_generic_get_report_descriptor 74 81 }; 75 82 … … 83 90 static size_t usb_generic_hid_get_event_length(ddf_fun_t *fun) 84 91 { 85 if (fun == NULL || fun->driver_data) { 92 usb_log_debug("Generic HID: Get event length (fun: %p, " 93 "fun->driver_data: %p.\n", fun, fun->driver_data); 94 95 if (fun == NULL || fun->driver_data == NULL) { 86 96 return 0; 87 97 } … … 89 99 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)fun->driver_data; 90 100 91 return hid_dev->input_report_size; 92 } 93 94 /*----------------------------------------------------------------------------*/ 95 96 static int usb_generic_hid_get_event(ddf_fun_t *fun, int32_t *buffer, 101 usb_log_debug("hid_dev: %p, Max input report size (%d).\n", 102 hid_dev, hid_dev->max_input_report_size); 103 104 return hid_dev->max_input_report_size; 105 } 106 107 /*----------------------------------------------------------------------------*/ 108 109 static int usb_generic_hid_get_event(ddf_fun_t *fun, uint8_t *buffer, 97 110 size_t size, size_t *act_size, unsigned int flags) 98 111 { 99 if (fun == NULL || fun->driver_data) { 112 usb_log_debug("Generic HID: Get event.\n"); 113 114 if (fun == NULL || fun->driver_data == NULL) { 115 usb_log_debug("No function"); 100 116 return EINVAL; 101 117 } … … 104 120 105 121 if (hid_dev->input_report_size > size) { 122 usb_log_debug("input_report_size > size (%zu, %zu)\n", 123 hid_dev->input_report_size, size); 106 124 return EINVAL; // TODO: other error code 107 125 } … … 109 127 /*! @todo This should probably be atomic. */ 110 128 if (usb_hid_report_ready()) { 129 usb_log_debug("Report ready, size: %zu\n", 130 hid_dev->input_report_size); 111 131 memcpy(buffer, hid_dev->input_report, 112 132 hid_dev->input_report_size); … … 120 140 // note that we already received this report 121 141 // report_received = true; 142 usb_log_debug("OK\n"); 143 144 return EOK; 145 } 146 147 /*----------------------------------------------------------------------------*/ 148 149 static size_t usb_generic_get_report_descriptor_length(ddf_fun_t *fun) 150 { 151 usb_log_debug("Generic HID: Get report descriptor length.\n"); 152 153 if (fun == NULL || fun->driver_data == NULL) { 154 usb_log_debug("No function"); 155 return EINVAL; 156 } 157 158 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)fun->driver_data; 159 160 printf("hid_dev->report_desc_size = %zu\n", hid_dev->report_desc_size); 161 162 return hid_dev->report_desc_size; 163 } 164 165 /*----------------------------------------------------------------------------*/ 166 167 static int usb_generic_get_report_descriptor(ddf_fun_t *fun, uint8_t *desc, 168 size_t size, size_t *actual_size) 169 { 170 usb_log_debug("Generic HID: Get report descriptor.\n"); 171 172 if (fun == NULL || fun->driver_data == NULL) { 173 usb_log_debug("No function"); 174 return EINVAL; 175 } 176 177 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)fun->driver_data; 178 179 if (hid_dev->report_desc_size > size) { 180 return EINVAL; // TODO: other error code 181 } 182 183 memcpy(desc, hid_dev->report_desc, hid_dev->report_desc_size); 184 *actual_size = hid_dev->report_desc_size; 122 185 123 186 return EOK; … … 128 191 static int usb_generic_hid_client_connected(ddf_fun_t *fun) 129 192 { 193 usb_log_debug("Generic HID: Client connected.\n"); 130 194 usb_hid_report_received(); 131 195 return EOK; … … 145 209 return ENOMEM; 146 210 } 211 212 fun->ops = &usb_generic_hid_ops; 213 fun->driver_data = hid_dev; 147 214 148 215 int rc = ddf_fun_bind(fun); … … 154 221 } 155 222 156 fun->ops = &usb_generic_hid_ops; 157 fun->driver_data = hid_dev; 223 usb_log_debug("HID function created. Handle: %d\n", fun->handle); 158 224 159 225 return EOK; -
uspace/drv/usbhid/kbd/kbddev.c
r14e1bcc r3e6e2b9 798 798 } 799 799 800 usb_log_debug("%s function created. Handle: %d\n", HID_KBD_FUN_NAME, 801 fun->handle); 802 800 803 usb_log_debug("Adding DDF function to class %s...\n", 801 804 HID_KBD_CLASS_NAME); -
uspace/drv/usbhid/multimedia/keymap.c
r14e1bcc r3e6e2b9 48 48 */ 49 49 static int usb_hid_keymap_consumer[0x29c] = { 50 [0xf] = KC_F1, /* Just for testing purposes */51 [0x5] = KC_F2, /* Just for testing purposes */52 [0x8] = KC_F3, /* Just for testing purposes */53 [0x6] = KC_F4, /* Just for testing purposes */54 [0x7] = KC_F5, /* Just for testing purposes */55 [0xc] = KC_F6, /* Just for testing purposes */56 57 50 [0xb5] = 0, /* Scan Next Track */ 58 51 [0xb6] = 0, /* Scan Previous Track */ … … 63 56 [0xe9] = KC_F5, /* Volume Increment */ 64 57 [0xea] = KC_F4, /* Volume Decrement */ 65 [0x183] = 0, /* AL Consumer Control Configuration */58 [0x183] = KC_F1, /* AL Consumer Control Configuration */ 66 59 [0x18a] = 0, /* AL Email Reader */ 67 60 [0x192] = 0, /* AL Calculator */ 68 61 [0x221] = 0, /* AC Search */ 69 [0x223] = 0, /* AC Home */62 [0x223] = KC_F6, /* AC Home */ 70 63 [0x224] = 0, /* AC Back */ 71 64 [0x225] = 0, /* AC Forward */ 72 65 [0x226] = 0, /* AC Stop */ 73 [0x227] = KC_F1, /* AC Refresh */ 74 [0x22a] = KC_F6 /* AC Bookmarks */ 75 }; 76 77 static const char *usb_hid_consumer_usage_str[0x29d] = { 78 [0x01] = "Consumer Control", 79 [0x02] = "Numeric Key Pad", 80 [0x03] = "Programmable Buttons", 81 [0x04] = "Microphone", 82 [0x05] = "Headphone", 83 [0x06] = "Graphic Equalizer", 84 [0x07] = "Reserved", 85 [0x08] = "Reserved", 86 [0x09] = "Reserved", 87 [0x0a] = "Reserved", 88 [0x0b] = "Reserved", 89 [0x0c] = "Reserved", 90 [0x0d] = "Reserved", 91 [0x0e] = "Reserved", 92 [0x0f] = "Reserved", 93 [0x10] = "Reserved", 94 [0x11] = "Reserved", 95 [0x12] = "Reserved", 96 [0x13] = "Reserved", 97 [0x14] = "Reserved", 98 [0x15] = "Reserved", 99 [0x16] = "Reserved", 100 [0x17] = "Reserved", 101 [0x18] = "Reserved", 102 [0x19] = "Reserved", 103 [0x1a] = "Reserved", 104 [0x1b] = "Reserved", 105 [0x1c] = "Reserved", 106 [0x1d] = "Reserved", 107 [0x1e] = "Reserved", 108 [0x1f] = "Reserved", 109 [0x20] = "+10", 110 [0x21] = "+100", 111 [0x22] = "AM/PM", 112 [0x23] = "Reserved", 113 [0x24] = "Reserved", 114 [0x25] = "Reserved", 115 [0x26] = "Reserved", 116 [0x27] = "Reserved", 117 [0x28] = "Reserved", 118 [0x29] = "Reserved", 119 [0x2a] = "Reserved", 120 [0x2b] = "Reserved", 121 [0x2c] = "Reserved", 122 [0x2d] = "Reserved", 123 [0x2e] = "Reserved", 124 [0x2f] = "Reserved", 125 [0x30] = "Reserved", 126 [0x31] = "Reserved", 127 [0x32] = "Reserved", 128 [0x33] = "Reserved", 129 [0x34] = "Reserved", 130 [0x35] = "Reserved", 131 [0x36] = "Reserved", 132 [0x37] = "Reserved", 133 [0x38] = "Reserved", 134 [0x39] = "Reserved", 135 [0x3a] = "Reserved", 136 [0x3b] = "Reserved", 137 [0x3c] = "Reserved", 138 [0x3d] = "Reserved", 139 [0x3e] = "Reserved", 140 [0x3f] = "Reserved", 141 [0x40] = "Menu", 142 [0x41] = "Menu Pick", 143 [0x42] = "Menu Up", 144 [0x43] = "Menu Down", 145 [0x44] = "Menu Left", 146 [0x45] = "Menu Right", 147 [0x46] = "Menu Escape", 148 [0x47] = "Menu Value Increase", 149 [0x48] = "Menu Value Decrease", 150 [0x49] = "Reserved", 151 [0x4a] = "Reserved", 152 [0x4b] = "Reserved", 153 [0x4c] = "Reserved", 154 [0x4d] = "Reserved", 155 [0x4e] = "Reserved", 156 [0x4f] = "Reserved", 157 [0x50] = "Reserved", 158 [0x51] = "Reserved", 159 [0x52] = "Reserved", 160 [0x53] = "Reserved", 161 [0x54] = "Reserved", 162 [0x55] = "Reserved", 163 [0x56] = "Reserved", 164 [0x57] = "Reserved", 165 [0x58] = "Reserved", 166 [0x59] = "Reserved", 167 [0x5a] = "Reserved", 168 [0x5b] = "Reserved", 169 [0x5c] = "Reserved", 170 [0x5d] = "Reserved", 171 [0x5e] = "Reserved", 172 [0x5f] = "Reserved", 173 [0x60] = "Data On Screen", 174 [0x61] = "Closed Caption", 175 [0x62] = "Closed Caption Select", 176 [0x63] = "VCR/TV", 177 [0x64] = "Broadcast Mode", 178 [0x65] = "Snapshot", 179 [0x66] = "Still", 180 [0x67] = "Reserved", 181 [0x68] = "Reserved", 182 [0x69] = "Reserved", 183 [0x6a] = "Reserved", 184 [0x6b] = "Reserved", 185 [0x6c] = "Reserved", 186 [0x6d] = "Reserved", 187 [0x6e] = "Reserved", 188 [0x6f] = "Reserved", 189 [0x70] = "Reserved", 190 [0x71] = "Reserved", 191 [0x72] = "Reserved", 192 [0x73] = "Reserved", 193 [0x74] = "Reserved", 194 [0x75] = "Reserved", 195 [0x76] = "Reserved", 196 [0x77] = "Reserved", 197 [0x78] = "Reserved", 198 [0x79] = "Reserved", 199 [0x7a] = "Reserved", 200 [0x7b] = "Reserved", 201 [0x7c] = "Reserved", 202 [0x7d] = "Reserved", 203 [0x7e] = "Reserved", 204 [0x7f] = "Reserved", 205 [0x80] = "Selection", 206 [0x81] = "Assign Selection", 207 [0x82] = "Mode Step", 208 [0x83] = "Recall Last", 209 [0x84] = "Enter Channel", 210 [0x85] = "Order Movie", 211 [0x86] = "Channel", 212 [0x87] = "Media Selection", 213 [0x88] = "Media Select Computer", 214 [0x89] = "Media Select TV", 215 [0x8a] = "Media Select WWW", 216 [0x8b] = "Media Select DVD", 217 [0x8c] = "Media Select Telephone", 218 [0x8d] = "Media Select Program Guide", 219 [0x8e] = "Media Select Video Phone", 220 [0x8f] = "Media Select Games", 221 [0x90] = "Media Select Messages", 222 [0x91] = "Media Select CD", 223 [0x92] = "Media Select VCR", 224 [0x93] = "Media Select Tuner", 225 [0x94] = "Quit", 226 [0x95] = "Help", 227 [0x96] = "Media Select Tape", 228 [0x97] = "Media Select Cable", 229 [0x98] = "Media Select Satellite", 230 [0x99] = "Media Select Security", 231 [0x9a] = "Media Select Home", 232 [0x9b] = "Media Select Call", 233 [0x9c] = "Channel Increment", 234 [0x9d] = "Channel Decrement", 235 [0x9e] = "Media Select SAP", 236 [0x9f] = "Reserved", 237 [0xa0] = "VCR Plus", 238 [0xa1] = "Once", 239 [0xa2] = "Daily", 240 [0xa3] = "Weekly", 241 [0xa4] = "Monthly", 242 [0xa5] = "Reserved", 243 [0xa6] = "Reserved", 244 [0xa7] = "Reserved", 245 [0xa8] = "Reserved", 246 [0xa9] = "Reserved", 247 [0xaa] = "Reserved", 248 [0xab] = "Reserved", 249 [0xac] = "Reserved", 250 [0xad] = "Reserved", 251 [0xae] = "Reserved", 252 [0xaf] = "Reserved", 253 [0xb0] = "Play", 254 [0xb1] = "Pause", 255 [0xb2] = "Record", 256 [0xb3] = "Fast Forward", 257 [0xb4] = "Rewind", 258 [0xb5] = "Scan Next Track", 259 [0xb6] = "Scan Previous Trac", 260 [0xb7] = "Stop", 261 [0xb8] = "Eject", 262 [0xb9] = "Random Play", 263 [0xba] = "Select Disc", 264 [0xbb] = "Enter Disc", 265 [0xbc] = "Repeat", 266 [0xbd] = "Tracking", 267 [0xbe] = "Track Normal", 268 [0xbf] = "Slow Tracking", 269 [0xc0] = "Frame Forward", 270 [0xc1] = "Frame Back", 271 [0xc2] = "Mark", 272 [0xc3] = "Clear Mark", 273 [0xc4] = "Repeat From Mark", 274 [0xc5] = "Return to Mark", 275 [0xc6] = "Search Mark Forward", 276 [0xc7] = "Search Mark Backwards", 277 [0xc8] = "Counter Reset", 278 [0xc9] = "Show Counter", 279 [0xca] = "Tracking Increment", 280 [0xcb] = "Tracking Decrement", 281 [0xcc] = "Stop/Eject", 282 [0xcd] = "Play/Pause", 283 [0xce] = "Play/Skip", 284 [0xcf] = "Reserved", 285 [0xd0] = "Reserved", 286 [0xd1] = "Reserved", 287 [0xd2] = "Reserved", 288 [0xd3] = "Reserved", 289 [0xd4] = "Reserved", 290 [0xd5] = "Reserved", 291 [0xd6] = "Reserved", 292 [0xd7] = "Reserved", 293 [0xd8] = "Reserved", 294 [0xd9] = "Reserved", 295 [0xda] = "Reserved", 296 [0xdb] = "Reserved", 297 [0xdc] = "Reserved", 298 [0xdd] = "Reserved", 299 [0xde] = "Reserved", 300 [0xdf] = "Reserved", 301 [0xe0] = "Volume", 302 [0xe1] = "Balance", 303 [0xe2] = "Mute", 304 [0xe3] = "Bass", 305 [0xe4] = "Treble", 306 [0xe5] = "Bass Boost", 307 [0xe6] = "Surround Mode", 308 [0xe7] = "Loudness", 309 [0xe8] = "MPX", 310 [0xe9] = "Volume Increment", 311 [0xea] = "Volume Decrement", 312 [0xeb] = "Reserved", 313 [0xec] = "Reserved", 314 [0xed] = "Reserved", 315 [0xee] = "Reserved", 316 [0xef] = "Reserved", 317 [0xf0] = "Speed Select", 318 [0xf1] = "Playback Speed", 319 [0xf2] = "Standard Play", 320 [0xf3] = "Long Play", 321 [0xf4] = "Extended Play", 322 [0xf5] = "Slow", 323 [0xf6] = "Reserved", 324 [0xf7] = "Reserved", 325 [0xf8] = "Reserved", 326 [0xf9] = "Reserved", 327 [0xfa] = "Reserved", 328 [0xfb] = "Reserved", 329 [0xfc] = "Reserved", 330 [0xfd] = "Reserved", 331 [0xfe] = "Reserved", 332 [0xff] = "Reserved", 333 [0x100] = "Fan Enable", 334 [0x101] = "Fan Speed", 335 [0x102] = "Light Enable", 336 [0x103] = "Light Illumination Level", 337 [0x104] = "Climate Control Enable", 338 [0x105] = "Room Temperature", 339 [0x106] = "Security Enable", 340 [0x107] = "Fire Alarm", 341 [0x108] = "Police Alarm", 342 [0x109] = "Proximity", 343 [0x10a] = "Motion", 344 [0x10b] = "Duress Alarm", 345 [0x10c] = "Holdup Alarm", 346 [0x10d] = "Medical Alarm", 347 [0x10e] = "Reserved", 348 [0x10f] = "Reserved", 349 [0x110] = "Reserved", 350 [0x111] = "Reserved", 351 [0x112] = "Reserved", 352 [0x113] = "Reserved", 353 [0x114] = "Reserved", 354 [0x115] = "Reserved", 355 [0x116] = "Reserved", 356 [0x117] = "Reserved", 357 [0x118] = "Reserved", 358 [0x119] = "Reserved", 359 [0x11a] = "Reserved", 360 [0x11b] = "Reserved", 361 [0x11c] = "Reserved", 362 [0x11d] = "Reserved", 363 [0x11e] = "Reserved", 364 [0x11f] = "Reserved", 365 [0x120] = "Reserved", 366 [0x121] = "Reserved", 367 [0x122] = "Reserved", 368 [0x123] = "Reserved", 369 [0x124] = "Reserved", 370 [0x125] = "Reserved", 371 [0x126] = "Reserved", 372 [0x127] = "Reserved", 373 [0x128] = "Reserved", 374 [0x129] = "Reserved", 375 [0x12a] = "Reserved", 376 [0x12b] = "Reserved", 377 [0x12c] = "Reserved", 378 [0x12d] = "Reserved", 379 [0x12e] = "Reserved", 380 [0x12f] = "Reserved", 381 [0x130] = "Reserved", 382 [0x131] = "Reserved", 383 [0x132] = "Reserved", 384 [0x133] = "Reserved", 385 [0x134] = "Reserved", 386 [0x135] = "Reserved", 387 [0x136] = "Reserved", 388 [0x137] = "Reserved", 389 [0x138] = "Reserved", 390 [0x139] = "Reserved", 391 [0x13a] = "Reserved", 392 [0x13b] = "Reserved", 393 [0x13c] = "Reserved", 394 [0x13d] = "Reserved", 395 [0x13e] = "Reserved", 396 [0x13f] = "Reserved", 397 [0x140] = "Reserved", 398 [0x141] = "Reserved", 399 [0x142] = "Reserved", 400 [0x143] = "Reserved", 401 [0x144] = "Reserved", 402 [0x145] = "Reserved", 403 [0x146] = "Reserved", 404 [0x147] = "Reserved", 405 [0x148] = "Reserved", 406 [0x149] = "Reserved", 407 [0x14a] = "Reserved", 408 [0x14b] = "Reserved", 409 [0x14c] = "Reserved", 410 [0x14d] = "Reserved", 411 [0x14e] = "Reserved", 412 [0x14f] = "Reserved", 413 [0x150] = "Balance Right", 414 [0x151] = "Balance Left", 415 [0x152] = "Bass Increment", 416 [0x153] = "Bass Decrement", 417 [0x154] = "Treble Increment", 418 [0x155] = "Treble Decrement", 419 [0x156] = "Reserved", 420 [0x157] = "Reserved", 421 [0x158] = "Reserved", 422 [0x159] = "Reserved", 423 [0x15a] = "Reserved", 424 [0x15b] = "Reserved", 425 [0x15c] = "Reserved", 426 [0x15d] = "Reserved", 427 [0x15e] = "Reserved", 428 [0x15f] = "Reserved", 429 [0x160] = "Speaker System", 430 [0x161] = "Channel Left", 431 [0x162] = "Channel Right", 432 [0x163] = "Channel Center", 433 [0x164] = "Channel Front", 434 [0x165] = "Channel Center Front", 435 [0x166] = "Channel Side", 436 [0x167] = "Channel Surround", 437 [0x168] = "Channel Low Frequency Enhancement", 438 [0x169] = "Channel Top", 439 [0x16a] = "Channel Unknown", 440 [0x16b] = "Reserved", 441 [0x16c] = "Reserved", 442 [0x16d] = "Reserved", 443 [0x16e] = "Reserved", 444 [0x16f] = "Reserved", 445 [0x170] = "Sub-channel", 446 [0x171] = "Sub-channel Increment", 447 [0x172] = "Sub-channel Decrement", 448 [0x173] = "Alternate Audio Increment", 449 [0x174] = "Alternate Audio Decrement", 450 [0x175] = "Reserved", 451 [0x176] = "Reserved", 452 [0x177] = "Reserved", 453 [0x178] = "Reserved", 454 [0x179] = "Reserved", 455 [0x17a] = "Reserved", 456 [0x17b] = "Reserved", 457 [0x17c] = "Reserved", 458 [0x17d] = "Reserved", 459 [0x17e] = "Reserved", 460 [0x17f] = "Reserved", 461 [0x180] = "Application Launch Buttons", 462 [0x181] = "AL Launch Buttion Configuration Tool", 463 [0x182] = "AL Programmable Button Configuration", 464 [0x183] = "AL Consumer Control Configuration", 465 [0x184] = "AL Word Processor", 466 [0x185] = "AL Text Editor", 467 [0x186] = "AL Spreadsheet", 468 [0x187] = "AL Graphics Editor", 469 [0x188] = "AL Presentation App", 470 [0x189] = "AL Database App", 471 [0x18a] = "AL Email Reader", 472 [0x18b] = "AL Newsreader", 473 [0x18c] = "AL Voicemail", 474 [0x18d] = "AL Contacts/Address Book", 475 [0x18e] = "AL Calendar/Schedule", 476 [0x18f] = "AL Task/Project Manager", 477 [0x190] = "AL Log/Journal/Timecard", 478 [0x191] = "AL Checkbook/Finance", 479 [0x192] = "AL Calculator", 480 [0x193] = "AL A/V Capture/Playback", 481 [0x194] = "AL Local Machine Browser", 482 [0x195] = "AL LAN/WAN Browser", 483 [0x196] = "AL Internet Browser", 484 [0x197] = "AL Remote Networking/ISP Connect", 485 [0x198] = "AL Network Conference", 486 [0x199] = "AL Network Chat", 487 [0x19a] = "AL Telephony/Dialer", 488 [0x19b] = "AL Logon", 489 [0x19c] = "AL Logoff", 490 [0x19d] = "AL Logon/Logoff", 491 [0x19e] = "AL Terminal Lock/Screensaver", 492 [0x19f] = "AL Control Panel", 493 [0x1a0] = "AL Command Line Processor/Run", 494 [0x1a1] = "AL Process/Task Manager", 495 [0x1a2] = "AL Select Task/Application", 496 [0x1a3] = "AL Next Task/Application", 497 [0x1a4] = "AL Previous Task/Application", 498 [0x1a5] = "AL Preemptive Halt Task/Application", 499 [0x1a6] = "AL Integrated Help Center", 500 [0x1a7] = "AL Documents", 501 [0x1a8] = "AL Thesaurus", 502 [0x1a9] = "AL Dictionary", 503 [0x1aa] = "AL Desktop", 504 [0x1ab] = "AL Spell Check", 505 [0x1ac] = "AL Grammar Check", 506 [0x1ad] = "AL Wireless Status", 507 [0x1ae] = "AL Keyboard Layout", 508 [0x1af] = "AL Virus Protection", 509 [0x1b0] = "AL Encryption", 510 [0x1b1] = "AL Screen Saver", 511 [0x1b2] = "AL Alarms", 512 [0x1b3] = "AL Clock", 513 [0x1b4] = "AL File Browser", 514 [0x1b5] = "AL Power Status", 515 [0x1b6] = "AL Image Browser", 516 [0x1b7] = "AL Audio Browser", 517 [0x1b8] = "AL Movie Browser", 518 [0x1b9] = "AL Digital Rights Manager", 519 [0x1ba] = "AL Digital Wallet", 520 [0x1bb] = "Reserved", 521 [0x1bc] = "AL Instant Messaging", 522 [0x1bd] = "AL OEM Features Tips/Tutorial Browser", 523 [0x1be] = "AL OEM Help", 524 [0x1bf] = "AL Online Community", 525 [0x1c0] = "AL Entertainment Content Browser", 526 [0x1c1] = "AL Online Shopping Browser", 527 [0x1c2] = "AL SmartCard Information/Help", 528 [0x1c3] = "AL Market Monitor/Finance Browser", 529 [0x1c4] = "AL Customized Corporate News Browser", 530 [0x1c5] = "AL Online Activity Browser", 531 [0x1c6] = "AL Research/Search Browser", 532 [0x1c7] = "AL Audio Player", 533 [0x1c8] = "Reserved", 534 [0x1c9] = "Reserved", 535 [0x1ca] = "Reserved", 536 [0x1cb] = "Reserved", 537 [0x1cc] = "Reserved", 538 [0x1cd] = "Reserved", 539 [0x1ce] = "Reserved", 540 [0x1cf] = "Reserved", 541 [0x1d0] = "Reserved", 542 [0x1d1] = "Reserved", 543 [0x1d2] = "Reserved", 544 [0x1d3] = "Reserved", 545 [0x1d4] = "Reserved", 546 [0x1d5] = "Reserved", 547 [0x1d6] = "Reserved", 548 [0x1d7] = "Reserved", 549 [0x1d8] = "Reserved", 550 [0x1d9] = "Reserved", 551 [0x1da] = "Reserved", 552 [0x1db] = "Reserved", 553 [0x1dc] = "Reserved", 554 [0x1dd] = "Reserved", 555 [0x1de] = "Reserved", 556 [0x1df] = "Reserved", 557 [0x1e0] = "Reserved", 558 [0x1e1] = "Reserved", 559 [0x1e2] = "Reserved", 560 [0x1e3] = "Reserved", 561 [0x1e4] = "Reserved", 562 [0x1e5] = "Reserved", 563 [0x1e6] = "Reserved", 564 [0x1e7] = "Reserved", 565 [0x1e8] = "Reserved", 566 [0x1e9] = "Reserved", 567 [0x1ea] = "Reserved", 568 [0x1eb] = "Reserved", 569 [0x1ec] = "Reserved", 570 [0x1ed] = "Reserved", 571 [0x1ee] = "Reserved", 572 [0x1ef] = "Reserved", 573 [0x1f0] = "Reserved", 574 [0x1f1] = "Reserved", 575 [0x1f2] = "Reserved", 576 [0x1f3] = "Reserved", 577 [0x1f4] = "Reserved", 578 [0x1f5] = "Reserved", 579 [0x1f6] = "Reserved", 580 [0x1f7] = "Reserved", 581 [0x1f8] = "Reserved", 582 [0x1f9] = "Reserved", 583 [0x1fa] = "Reserved", 584 [0x1fb] = "Reserved", 585 [0x1fc] = "Reserved", 586 [0x1fd] = "Reserved", 587 [0x1fe] = "Reserved", 588 [0x1ff] = "Reserved", 589 [0x200] = "Generic GUI Application Controls", 590 [0x201] = "AC New", 591 [0x202] = "AC Open", 592 [0x203] = "AC Close", 593 [0x204] = "AC Exit", 594 [0x205] = "AC Maximize", 595 [0x206] = "AC Minimize", 596 [0x207] = "AC Save", 597 [0x208] = "AC Print", 598 [0x209] = "AC Properties", 599 [0x20a] = "", 600 [0x20b] = "", 601 [0x20c] = "", 602 [0x20d] = "", 603 [0x20e] = "", 604 [0x20f] = "", 605 [0x210] = "", 606 [0x211] = "", 607 [0x212] = "", 608 [0x213] = "", 609 [0x214] = "", 610 [0x215] = "", 611 [0x216] = "", 612 [0x217] = "", 613 [0x218] = "", 614 [0x219] = "", 615 [0x21a] = "AC Undo", 616 [0x21b] = "AC Copy", 617 [0x21c] = "AC Cut", 618 [0x21d] = "AC Paste", 619 [0x21e] = "AC Select All", 620 [0x21f] = "AC Find", 621 [0x220] = "AC Find and Replace", 622 [0x221] = "AC Search", 623 [0x222] = "AC Go To", 624 [0x223] = "AC Home", 625 [0x224] = "AC Back", 626 [0x225] = "AC Forward", 627 [0x226] = "AC Stop", 628 [0x227] = "AC Refresh", 629 [0x228] = "AC Previous Link", 630 [0x229] = "AC Next Link", 631 [0x22a] = "AC Bookmarks", 632 [0x22b] = "AC History", 633 [0x22c] = "AC Subscriptions", 634 [0x22d] = "AC Zoom In", 635 [0x22e] = "AC Zoom Out", 636 [0x22f] = "AC Zoom", 637 [0x230] = "AC Full Screen View", 638 [0x231] = "AC Normal View", 639 [0x232] = "AC View Toggle", 640 [0x233] = "AC Scroll Up", 641 [0x234] = "AC Scroll Down", 642 [0x235] = "AC Scroll", 643 [0x236] = "AC Pan Left", 644 [0x237] = "AC Pan Right", 645 [0x238] = "AC Pan", 646 [0x239] = "AC New Window", 647 [0x23a] = "AC Tile Horizontally", 648 [0x23b] = "AC Tile Vertically", 649 [0x23c] = "AC Format", 650 [0x23d] = "AC Edit", 651 [0x23e] = "AC Bold", 652 [0x23f] = "AC Italics", 653 [0x240] = "AC Undeline", 654 [0x241] = "AC Strikethrough", 655 [0x242] = "AC Subscript", 656 [0x243] = "AC Superscript", 657 [0x244] = "AC All Caps", 658 [0x245] = "AC Rotate", 659 [0x246] = "AC Resize", 660 [0x247] = "AC Flip Horizontal", 661 [0x248] = "AC Flip Vertical", 662 [0x249] = "AC Mirror Horizontal", 663 [0x24a] = "AC Mirror Vertical", 664 [0x24b] = "AC Font Select", 665 [0x24c] = "AC Font Color", 666 [0x24d] = "AC Font Size", 667 [0x24e] = "AC Justify Left", 668 [0x24f] = "AC Justify Center H", 669 [0x250] = "AC Justify Right", 670 [0x251] = "AC Justify Block H", 671 [0x252] = "AC Justify Top", 672 [0x253] = "AC Justify Center V", 673 [0x254] = "AC Justify Bottom", 674 [0x255] = "AC Justify Block V", 675 [0x256] = "AC Indent Decrease", 676 [0x257] = "AC Indent Increase", 677 [0x258] = "AC Numbered List", 678 [0x259] = "AC Restart Numbering", 679 [0x25a] = "AC Bulleted List", 680 [0x25b] = "AC Promote", 681 [0x25c] = "AC Demote", 682 [0x25d] = "AC Yes", 683 [0x25e] = "AC No", 684 [0x25f] = "AC Cancel", 685 [0x260] = "AC Catalog", 686 [0x261] = "AC Buy/Checkout", 687 [0x262] = "AC Add to Cart", 688 [0x263] = "AC Expand", 689 [0x264] = "AC Expand All", 690 [0x265] = "AC Collapse", 691 [0x266] = "AC Collapse All", 692 [0x267] = "AC Print Preview", 693 [0x268] = "AC Paste Special", 694 [0x269] = "AC Insert Mode", 695 [0x26a] = "AC Delete", 696 [0x26b] = "AC Lock", 697 [0x26c] = "AC Unlock", 698 [0x26d] = "AC Protect", 699 [0x26e] = "AC Unprotect", 700 [0x26f] = "AC Attach Comment", 701 [0x270] = "AC Delete Comment", 702 [0x271] = "AC View Comment", 703 [0x272] = "AC Select Word", 704 [0x273] = "AC Select Sentence", 705 [0x274] = "AC Select Paragraph", 706 [0x275] = "AC Select Column", 707 [0x276] = "AC Select Row", 708 [0x277] = "AC Select Table", 709 [0x278] = "AC Select Object", 710 [0x279] = "AC Redo/Repeat", 711 [0x27a] = "AC Sort", 712 [0x27b] = "AC Sort Ascending", 713 [0x27c] = "AC Sort Descending", 714 [0x27d] = "AC Filter", 715 [0x27e] = "AC Set Clock", 716 [0x27f] = "AC View Clock", 717 [0x280] = "AC Select Time Zone", 718 [0x281] = "AC Edit Time Zones", 719 [0x282] = "AC Set Alarm", 720 [0x283] = "AC Clear Alarm", 721 [0x284] = "AC Snooze Alarm", 722 [0x285] = "AC Reset Alarm", 723 [0x286] = "AC Synchronize", 724 [0x287] = "AC Send/Receive", 725 [0x288] = "AC Send To", 726 [0x289] = "AC Reply", 727 [0x28a] = "AC Reply All", 728 [0x28b] = "AC Forward Msg", 729 [0x28c] = "AC Send", 730 [0x28d] = "AC Attach File", 731 [0x28e] = "AC Upload", 732 [0x28f] = "AC Download (Save Target As)", 733 [0x290] = "AC Set Borders", 734 [0x291] = "AC Insert Row", 735 [0x292] = "AC Insert Column", 736 [0x293] = "AC Insert File", 737 [0x294] = "AC Insert Picture", 738 [0x295] = "AC Insert Object", 739 [0x296] = "AC Insert Symbol", 740 [0x297] = "AC Save and Close", 741 [0x298] = "AC Rename", 742 [0x299] = "AC Merge", 743 [0x29a] = "AC Split", 744 [0x29b] = "AC Distrubute Horizontally", 745 [0x29c] = "AC Distrubute Vertically" 66 [0x227] = 0, /* AC Refresh */ 67 [0x22a] = 0 /* AC Bookmarks */ 746 68 }; 747 69 … … 769 91 770 92 /** 771 * Translates USB HID Usages from the Consumer Page into their string772 * representation.773 *774 * @param usage USB HID Consumer Page Usage number.775 *776 * @retval HelenOS key code corresponding to the given USB Consumer Page Usage.777 */778 const char *usb_multimedia_usage_to_str(int usage)779 {780 size_t map_length = sizeof(usb_hid_consumer_usage_str) / sizeof(char *);781 782 if ((usage < 0) || ((size_t)usage >= map_length))783 return "Unknown usage";784 785 /*! @todo What if the usage is not in the table? */786 return usb_hid_consumer_usage_str[usage];787 }788 789 /**790 93 * @} 791 94 */ -
uspace/drv/usbhid/multimedia/keymap.h
r14e1bcc r3e6e2b9 39 39 unsigned int usb_multimedia_map_usage(int usage); 40 40 41 const char *usb_multimedia_usage_to_str(int usage);42 43 41 #endif /* USB_HID_MULTIMEDIA_KEYMAP_H_ */ 44 42 -
uspace/drv/usbhid/multimedia/multimedia.c
r14e1bcc r3e6e2b9 43 43 #include <usb/debug.h> 44 44 #include <usb/hid/usages/core.h> 45 #include <usb/hid/usages/consumer.h> 45 46 46 47 #include <errno.h> … … 210 211 } 211 212 213 usb_log_debug("%s function created. Handle: %d\n", NAME, fun->handle); 214 212 215 rc = ddf_fun_add_to_class(fun, "keyboard"); 213 216 if (rc != EOK) { … … 247 250 248 251 multim_dev->key_count = usb_hid_report_size( 249 hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT);252 hid_dev->report, 1, USB_HID_REPORT_TYPE_INPUT); 250 253 251 254 usb_hid_report_path_free(path); … … 357 360 usb_multimedia_map_usage(field->usage); 358 361 const char *key_str = 359 usb _multimedia_usage_to_str(field->usage);362 usbhid_multimedia_usage_to_str(field->usage); 360 363 usb_log_info("Pressed key: %s\n", key_str); 361 364 usb_multimedia_push_ev(hid_dev, multim_dev, KEY_PRESS, -
uspace/drv/usbhid/subdrivers.c
r14e1bcc r3e6e2b9 38 38 #include <usb/hid/hidpath.h> 39 39 40 //#include "lgtch-ultrax/lgtch-ultrax.h"41 40 #include "multimedia/multimedia.h" 42 41 #include "mouse/mousedev.h" 42 #include "generic/hiddev.h" 43 43 44 44 static usb_hid_subdriver_usage_t path_kbd[] = { … … 58 58 }; 59 59 60 //static usb_hid_subdriver_usage_t generic_hid_key_path[] = { 61 // {0, 0} 62 //}; 63 60 64 const usb_hid_subdriver_mapping_t usb_hid_subdrivers[] = { 61 65 { 62 66 path_kbd, 63 -1,67 0, 64 68 USB_HID_PATH_COMPARE_BEGIN, 65 69 -1, … … 88 92 { 89 93 path_mouse, 90 -1,94 0, 91 95 USB_HID_PATH_COMPARE_BEGIN, 92 96 -1, … … 99 103 } 100 104 }, 105 // { 106 // generic_hid_key_path, 107 // 0, 108 // USB_HID_PATH_COMPARE_ANYWHERE, 109 // -1, 110 // -1, 111 // { 112 // .init = usb_generic_hid_init, 113 // .deinit = NULL, 114 // .poll = usb_generic_hid_polling_callback, 115 // .poll_end = NULL 116 // } 117 // }, 101 118 {NULL, -1, 0, -1, -1, {NULL, NULL, NULL, NULL, NULL}} 102 119 }; -
uspace/drv/usbhid/usbhid.c
r14e1bcc r3e6e2b9 234 234 } 235 235 236 hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc(count * 236 // add one generic HID subdriver per device 237 238 hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc((count + 1) * 237 239 sizeof(usb_hid_subdriver_t)); 238 240 if (hid_dev->subdrivers == NULL) { … … 247 249 } 248 250 249 hid_dev->subdriver_count = count; 251 hid_dev->subdrivers[count].init = usb_generic_hid_init; 252 hid_dev->subdrivers[count].poll = usb_generic_hid_polling_callback; 253 hid_dev->subdrivers[count].deinit = NULL; 254 hid_dev->subdrivers[count].poll_end = NULL; 255 256 hid_dev->subdriver_count = count + 1; 250 257 251 258 return EOK; … … 307 314 308 315 if (matched) { 316 usb_log_debug("Subdriver matched.\n"); 309 317 subdrivers[count++] = &mapping->subdriver; 310 318 } … … 348 356 /*----------------------------------------------------------------------------*/ 349 357 358 static int usb_hid_init_report(usb_hid_dev_t *hid_dev) 359 { 360 assert(hid_dev != NULL && hid_dev->report != NULL); 361 362 uint8_t report_id = 0; 363 size_t size = usb_hid_report_byte_size(hid_dev->report, report_id, 364 USB_HID_REPORT_TYPE_INPUT); 365 366 size_t max_size = 0; 367 368 do { 369 max_size = (size > max_size) ? size : max_size; 370 size = usb_hid_report_byte_size(hid_dev->report, report_id, 371 USB_HID_REPORT_TYPE_INPUT); 372 report_id = usb_hid_get_next_report_id(hid_dev->report, 373 report_id, USB_HID_REPORT_TYPE_INPUT); 374 } while (report_id != 0); 375 376 usb_log_debug("Max size of input report: %zu\n", max_size); 377 378 hid_dev->max_input_report_size = max_size; 379 assert(hid_dev->input_report == NULL); 380 381 hid_dev->input_report = malloc(max_size); 382 if (hid_dev->input_report == NULL) { 383 return ENOMEM; 384 } 385 memset(hid_dev->input_report, 0, max_size); 386 387 return EOK; 388 } 389 390 /*----------------------------------------------------------------------------*/ 391 350 392 usb_hid_dev_t *usb_hid_new(void) 351 393 { … … 402 444 /* Get the report descriptor and parse it. */ 403 445 rc = usb_hid_process_report_descriptor(hid_dev->usb_dev, 404 hid_dev->report );446 hid_dev->report, &hid_dev->report_desc, &hid_dev->report_desc_size); 405 447 406 448 bool fallback = false; … … 483 525 } 484 526 527 // save max input report size and allocate space for the report 528 rc = usb_hid_init_report(hid_dev); 529 if (rc != EOK) { 530 usb_log_error("Failed to initialize input report buffer.\n"); 531 } 532 485 533 return rc; 486 534 } … … 500 548 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg; 501 549 502 int allocated = (hid_dev->input_report != NULL); 503 504 if (!allocated 505 || hid_dev->input_report_size < buffer_size) { 506 uint8_t *input_old = hid_dev->input_report; 507 uint8_t *input_new = (uint8_t *)malloc(buffer_size); 508 509 if (input_new == NULL) { 510 usb_log_error("Failed to allocate space for input " 511 "buffer. This event may not be reported\n"); 512 memset(hid_dev->input_report, 0, 513 hid_dev->input_report_size); 514 } else { 515 memcpy(input_new, input_old, 516 hid_dev->input_report_size); 517 hid_dev->input_report = input_new; 518 if (allocated) { 519 free(input_old); 520 } 521 usb_hid_new_report(); 522 } 523 } 550 // int allocated = (hid_dev->input_report != NULL); 551 assert(hid_dev->input_report != NULL); 552 usb_log_debug("Max input report size: %zu, buffer size: %zu\n", 553 hid_dev->max_input_report_size, buffer_size); 554 assert(hid_dev->max_input_report_size >= buffer_size); 555 556 // if (/*!allocated*/ 557 // /*|| *//*hid_dev->input_report_size < buffer_size*/) { 558 // uint8_t *input_old = hid_dev->input_report; 559 // uint8_t *input_new = (uint8_t *)malloc(buffer_size); 560 561 // if (input_new == NULL) { 562 // usb_log_error("Failed to allocate space for input " 563 // "buffer. This event may not be reported\n"); 564 // memset(hid_dev->input_report, 0, 565 // hid_dev->input_report_size); 566 // } else { 567 // memcpy(input_new, input_old, 568 // hid_dev->input_report_size); 569 // hid_dev->input_report = input_new; 570 // if (allocated) { 571 // free(input_old); 572 // } 573 // usb_hid_new_report(); 574 // } 575 // } 524 576 525 577 /*! @todo This should probably be atomic. */ 526 578 memcpy(hid_dev->input_report, buffer, buffer_size); 527 579 hid_dev->input_report_size = buffer_size; 580 usb_hid_new_report(); 528 581 529 582 bool cont = false; -
uspace/drv/usbhid/usbhid.h
r14e1bcc r3e6e2b9 98 98 99 99 size_t input_report_size; 100 size_t max_input_report_size; 100 101 } usb_hid_dev_t; 101 102 -
uspace/lib/drv/Makefile
r14e1bcc r3e6e2b9 40 40 generic/remote_usb.c \ 41 41 generic/remote_pci.c \ 42 generic/remote_usbhc.c 42 generic/remote_usbhc.c \ 43 generic/remote_usbhid.c 43 44 44 45 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/drv/generic/dev_iface.c
r14e1bcc r3e6e2b9 46 46 #include "remote_pci.h" 47 47 48 #include <stdio.h> 49 48 50 static iface_dipatch_table_t remote_ifaces = { 49 51 .ifaces = { … … 60 62 { 61 63 assert(is_valid_iface_idx(idx)); 64 62 65 return remote_ifaces.ifaces[idx]; 63 66 } -
uspace/lib/drv/generic/driver.c
r14e1bcc r3e6e2b9 405 405 /* The interface has not such method */ 406 406 printf("%s: driver_connection_gen error - " 407 "invalid interface method.", driver->name); 407 "invalid interface method (%d).\n", 408 driver->name, iface_method_idx); 408 409 async_answer_0(callid, ENOTSUP); 409 410 break; -
uspace/lib/drv/generic/remote_usbhid.c
r14e1bcc r3e6e2b9 36 36 #include <errno.h> 37 37 #include <assert.h> 38 #include <stdio.h> 38 39 39 40 #include "usbhid_iface.h" … … 42 43 static void remote_usbhid_get_event_length(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 43 44 static void remote_usbhid_get_event(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 45 static void remote_usbhid_get_report_descriptor_length(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 46 static void remote_usbhid_get_report_descriptor(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 44 47 // static void remote_usbhid_(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 45 48 … … 47 50 static remote_iface_func_ptr_t remote_usbhid_iface_ops [] = { 48 51 remote_usbhid_get_event_length, 49 remote_usbhid_get_event 52 remote_usbhid_get_event, 53 remote_usbhid_get_report_descriptor_length, 54 remote_usbhid_get_report_descriptor 50 55 }; 51 56 … … 58 63 }; 59 64 60 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;65 //usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface; 61 66 62 67 … … 64 69 ipc_callid_t callid, ipc_call_t *call) 65 70 { 71 printf("remote_usbhid_get_event_length()\n"); 72 66 73 usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface; 67 74 68 75 if (!hid_iface->get_event_length) { 69 async_answer_0(callid, ENOTSUP); 70 return; 71 } 72 73 int len = hid_iface->get_event_length(fun); 74 if (len == 0) { 75 len = EEMPTY; 76 } 77 if (len < 0) { 78 async_answer_0(callid, len); 79 } else { 80 async_answer_1(callid, EOK, len); 81 } 76 printf("Get event length not set!\n"); 77 async_answer_0(callid, ENOTSUP); 78 return; 79 } 80 81 size_t len = hid_iface->get_event_length(fun); 82 // if (len == 0) { 83 // len = EEMPTY; 84 // } 85 async_answer_1(callid, EOK, len); 86 87 // if (len < 0) { 88 // async_answer_0(callid, len); 89 // } else { 90 // async_answer_1(callid, EOK, len); 91 // } 82 92 } 83 93 … … 100 110 return; 101 111 } 102 /* Check that length is even number. Truncate otherwise. */103 if ((len % 2) == 1) {104 len--;105 }112 // /* Check that length is even number. Truncate otherwise. */ 113 // if ((len % 2) == 1) { 114 // len--; 115 // } 106 116 if (len == 0) { 107 117 async_answer_0(data_callid, EINVAL); 108 118 async_answer_0(callid, EINVAL); 119 return; 109 120 } 110 121 111 122 int rc; 112 123 113 size_t items = len / 2; 114 uint16_t *usage_pages_and_usages = malloc(sizeof(uint16_t) * len); 115 if (usage_pages_and_usages == NULL) { 124 uint8_t *data = malloc(len); 125 if (data == NULL) { 116 126 async_answer_0(data_callid, ENOMEM); 117 127 async_answer_0(callid, ENOMEM); 118 }119 120 size_t act_items; 121 int rc = hid_iface->get_event(fun, usage_pages_and_usages,122 usage_pages_and_usages + items, items, &act_items, flags);128 return; 129 } 130 131 size_t act_length; 132 rc = hid_iface->get_event(fun, data, len, &act_length, flags); 123 133 if (rc != EOK) { 124 free( usage_pages_and_usages);134 free(data); 125 135 async_answer_0(data_callid, rc); 126 136 async_answer_0(callid, rc); 127 } 128 if (act_items >= items) { 137 return; 138 } 139 if (act_length >= len) { 129 140 /* This shall not happen. */ 130 141 // FIXME: how about an assert here? 131 act_items = items; 132 } 133 134 async_data_read_finalize(data_callid, usage_pages_and_usages, 135 act_items * 2 * sizeof(uint16_t)); 136 137 free(usage_pages_and_usages); 142 act_length = len; 143 } 144 145 async_data_read_finalize(data_callid, data, act_length); 146 147 free(data); 138 148 139 149 async_answer_0(callid, EOK); 140 150 } 151 152 void remote_usbhid_get_report_descriptor_length(ddf_fun_t *fun, void *iface, 153 ipc_callid_t callid, ipc_call_t *call) 154 { 155 usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface; 156 157 if (!hid_iface->get_report_descriptor_length) { 158 async_answer_0(callid, ENOTSUP); 159 return; 160 } 161 162 size_t len = hid_iface->get_report_descriptor_length(fun); 163 async_answer_1(callid, EOK, (sysarg_t) len); 164 } 165 166 void remote_usbhid_get_report_descriptor(ddf_fun_t *fun, void *iface, 167 ipc_callid_t callid, ipc_call_t *call) 168 { 169 usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface; 170 171 if (!hid_iface->get_report_descriptor) { 172 async_answer_0(callid, ENOTSUP); 173 return; 174 } 175 176 size_t len; 177 ipc_callid_t data_callid; 178 if (!async_data_read_receive(&data_callid, &len)) { 179 async_answer_0(callid, EINVAL); 180 return; 181 } 182 183 if (len == 0) { 184 async_answer_0(data_callid, EINVAL); 185 async_answer_0(callid, EINVAL); 186 return; 187 } 188 189 uint8_t *descriptor = malloc(len); 190 if (descriptor == NULL) { 191 async_answer_0(data_callid, ENOMEM); 192 async_answer_0(callid, ENOMEM); 193 return; 194 } 195 196 size_t act_len = 0; 197 int rc = hid_iface->get_report_descriptor(fun, descriptor, len, 198 &act_len); 199 if (act_len > len) { 200 rc = ELIMIT; 201 } 202 if (rc != EOK) { 203 free(descriptor); 204 async_answer_0(data_callid, rc); 205 async_answer_0(callid, rc); 206 return; 207 } 208 209 async_data_read_finalize(data_callid, descriptor, act_len); 210 async_answer_0(callid, EOK); 211 212 free(descriptor); 213 } 214 215 141 216 142 217 /** -
uspace/lib/drv/include/remote_usbhid.h
r14e1bcc r3e6e2b9 36 36 #define LIBDRV_REMOTE_USBHID_H_ 37 37 38 remote_iface_t remote_usbhid_iface;38 extern remote_iface_t remote_usbhid_iface; 39 39 40 40 #endif -
uspace/lib/drv/include/usbhid_iface.h
r14e1bcc r3e6e2b9 45 45 * Parameters: none 46 46 * Answer: 47 * - EOK (expected always as long as device support USB HID interface) 48 * Parameters of the answer: 49 * - number of items 47 * - Size of one report in bytes. 50 48 */ 51 49 IPC_M_USBHID_GET_EVENT_LENGTH, … … 63 61 * It is okay if the client requests less data. Extra data must 64 62 * be truncated by the driver. 63 * 64 * @todo Change this comment. 65 65 */ 66 IPC_M_USBHID_GET_EVENT 66 IPC_M_USBHID_GET_EVENT, 67 68 /** Get the size of the report descriptor from the HID device. 69 * 70 * Parameters: 71 * - none 72 * Answer: 73 * - EOK - method is implemented (expected always) 74 * Parameters of the answer: 75 * - Size of the report in bytes. 76 */ 77 IPC_M_USBHID_GET_REPORT_DESCRIPTOR_LENGTH, 78 79 /** Get the report descriptor from the HID device. 80 * 81 * Parameters: 82 * - none 83 * The call is followed by data read expecting the descriptor itself. 84 * Answer: 85 * - EOK - report descriptor returned. 86 */ 87 IPC_M_USBHID_GET_REPORT_DESCRIPTOR 67 88 } usbhid_iface_funcs_t; 68 89 … … 75 96 * 76 97 * @param[in] fun DDF function answering the request. 77 * @return Number of events or error code.98 * @return Size of the event in bytes. 78 99 */ 79 100 size_t (*get_event_length)(ddf_fun_t *fun); … … 87 108 * @return Error code. 88 109 */ 89 int (*get_event)(ddf_fun_t *fun, int32_t *buffer, size_t size,110 int (*get_event)(ddf_fun_t *fun, uint8_t *buffer, size_t size, 90 111 size_t *act_size, unsigned int flags); 112 113 /** Get size of the report descriptor in bytes. 114 * 115 * @param[in] fun DDF function answering the request. 116 * @return Size of the report descriptor in bytes. 117 */ 118 size_t (*get_report_descriptor_length)(ddf_fun_t *fun); 119 120 /** Get the report descriptor from the HID device. 121 * 122 * @param[in] fun DDF function answering the request. 123 * @param[out] desc Buffer with the report descriptor. 124 * @param[in] size Size of the allocated @p desc buffer. 125 * @param[out] act_size Actual size of the report descriptor returned. 126 * @return Error code. 127 */ 128 int (*get_report_descriptor)(ddf_fun_t *fun, uint8_t *desc, 129 size_t size, size_t *act_size); 91 130 } usbhid_iface_t; 92 131 -
uspace/lib/usbhid/Makefile
r14e1bcc r3e6e2b9 41 41 src/hidpath.c \ 42 42 src/hidreport.c \ 43 src/consumer.c \ 43 44 src/hidreq.c 44 45 -
uspace/lib/usbhid/include/usb/hid/hidreport.h
r14e1bcc r3e6e2b9 44 44 * report parser. 45 45 * 46 * \param dev USB device representing a HID device. 47 * \param parser HID Report parser. 46 * \param[in] dev USB device representing a HID device. 47 * \param[in/out] parser HID Report parser. 48 * \param[out] report_desc Place to save report descriptor into. 49 * \param[out] report_size 48 50 * 49 51 * \retval EOK if successful. … … 57 59 */ 58 60 int usb_hid_process_report_descriptor(usb_device_t *dev, 59 usb_hid_report_t *report );61 usb_hid_report_t *report, uint8_t **report_desc, size_t *report_size); 60 62 61 63 #endif /* LIBUSB_HIDREPORT_H_ */ -
uspace/lib/usbhid/include/usb/hid/iface.h
r14e1bcc r3e6e2b9 38 38 #include <sys/types.h> 39 39 40 int usbhid_dev_get_event_length(int );41 int usbhid_dev_get_event(int, uint 16_t *, uint16_t *, size_t, size_t *,40 int usbhid_dev_get_event_length(int, size_t *); 41 int usbhid_dev_get_event(int, uint8_t *, size_t, size_t *, 42 42 unsigned int); 43 int usbhid_dev_get_report_descriptor_length(int, size_t *); 44 int usbhid_dev_get_report_descriptor(int, uint8_t *, size_t, size_t *); 43 45 44 46 #endif -
uspace/lib/usbhid/src/hidiface.c
r14e1bcc r3e6e2b9 46 46 * @return Number of usages returned or negative error code. 47 47 */ 48 int usbhid_dev_get_event_length(int dev_phone )48 int usbhid_dev_get_event_length(int dev_phone, size_t *size) 49 49 { 50 50 if (dev_phone < 0) { … … 56 56 IPC_M_USBHID_GET_EVENT_LENGTH, &len); 57 57 if (rc == EOK) { 58 return (int) len; 59 } else { 60 return rc; 61 } 58 if (size != NULL) { 59 *size = (size_t) len; 60 } 61 } 62 63 return rc; 62 64 } 63 65 … … 74 76 * @return Error code. 75 77 */ 76 int usbhid_dev_get_event(int dev_phone, uint16_t *usage_pages, uint16_t *usages, 77 size_t usage_count, size_t *actual_usage_count, unsigned int flags) 78 { 79 if (dev_phone < 0) { 80 return EINVAL; 81 } 82 if ((usage_pages == NULL) || (usages == NULL)) { 83 return ENOMEM; 84 } 85 if (usage_count == 0) { 86 return EINVAL; 87 } 88 89 size_t buffer_size = sizeof(uint16_t) * usage_count * 2; 90 uint16_t *buffer = malloc(buffer_size); 78 int usbhid_dev_get_event(int dev_phone, uint8_t *buf, 79 size_t size, size_t *actual_size, unsigned int flags) 80 { 81 if (dev_phone < 0) { 82 return EINVAL; 83 } 84 if ((buf == NULL)) { 85 return ENOMEM; 86 } 87 if (size == 0) { 88 return EINVAL; 89 } 90 91 // if (size == 0) { 92 // return EOK; 93 // } 94 95 size_t buffer_size = size; 96 uint8_t *buffer = malloc(buffer_size); 91 97 if (buffer == NULL) { 92 98 return ENOMEM; … … 128 134 } 129 135 130 size_t actual_size = IPC_GET_ARG2(data_request_call); 131 size_t items = actual_size / 2; 136 size_t act_size = IPC_GET_ARG2(data_request_call); 132 137 133 138 /* Copy the individual items. */ 134 memcpy(usage_pages, buffer, items * sizeof(uint16_t)); 135 memcpy(usages, buffer + items, items * sizeof(uint16_t)); 136 137 if (actual_usage_count != NULL) { 138 *actual_usage_count = items; 139 memcpy(buf, buffer, act_size); 140 // memcpy(usages, buffer + items, items * sizeof(int32_t)); 141 142 if (actual_size != NULL) { 143 *actual_size = act_size; 144 } 145 146 return EOK; 147 } 148 149 150 int usbhid_dev_get_report_descriptor_length(int dev_phone, size_t *size) 151 { 152 if (dev_phone < 0) { 153 return EINVAL; 154 } 155 156 sysarg_t arg_size; 157 int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(USBHID_DEV_IFACE), 158 IPC_M_USBHID_GET_REPORT_DESCRIPTOR_LENGTH, &arg_size); 159 if (rc == EOK) { 160 if (size != NULL) { 161 *size = (size_t) arg_size; 162 } 163 } 164 return rc; 165 } 166 167 int usbhid_dev_get_report_descriptor(int dev_phone, uint8_t *buf, size_t size, 168 size_t *actual_size) 169 { 170 if (dev_phone < 0) { 171 return EINVAL; 172 } 173 if ((buf == NULL)) { 174 return ENOMEM; 175 } 176 if (size == 0) { 177 return EINVAL; 178 } 179 180 aid_t opening_request = async_send_1(dev_phone, 181 DEV_IFACE_ID(USBHID_DEV_IFACE), IPC_M_USBHID_GET_REPORT_DESCRIPTOR, 182 NULL); 183 if (opening_request == 0) { 184 return ENOMEM; 185 } 186 187 ipc_call_t data_request_call; 188 aid_t data_request = async_data_read(dev_phone, buf, size, 189 &data_request_call); 190 if (data_request == 0) { 191 async_wait_for(opening_request, NULL); 192 return ENOMEM; 193 } 194 195 sysarg_t data_request_rc; 196 sysarg_t opening_request_rc; 197 async_wait_for(data_request, &data_request_rc); 198 async_wait_for(opening_request, &opening_request_rc); 199 200 if (data_request_rc != EOK) { 201 /* Prefer return code of the opening request. */ 202 if (opening_request_rc != EOK) { 203 return (int) opening_request_rc; 204 } else { 205 return (int) data_request_rc; 206 } 207 } 208 209 if (opening_request_rc != EOK) { 210 return (int) opening_request_rc; 211 } 212 213 size_t act_size = IPC_GET_ARG2(data_request_call); 214 215 if (actual_size != NULL) { 216 *actual_size = act_size; 139 217 } 140 218 -
uspace/lib/usbhid/src/hidreport.c
r14e1bcc r3e6e2b9 164 164 165 165 int usb_hid_process_report_descriptor(usb_device_t *dev, 166 usb_hid_report_t *report )166 usb_hid_report_t *report, uint8_t **report_desc, size_t *report_size) 167 167 { 168 168 if (dev == NULL || report == NULL) { … … 172 172 } 173 173 174 uint8_t *report_desc = NULL; 175 size_t report_size; 176 177 int rc = usb_hid_get_report_descriptor(dev, &report_desc, 178 &report_size); 174 // uint8_t *report_desc = NULL; 175 // size_t report_size; 176 177 int rc = usb_hid_get_report_descriptor(dev, report_desc, report_size); 179 178 180 179 if (rc != EOK) { 181 180 usb_log_error("Problem with getting Report descriptor: %s.\n", 182 181 str_error(rc)); 183 if (report_desc != NULL) { 184 free(report_desc); 182 if (*report_desc != NULL) { 183 free(*report_desc); 184 *report_desc = NULL; 185 185 } 186 186 return rc; 187 187 } 188 188 189 assert( report_desc != NULL);190 191 rc = usb_hid_parse_report_descriptor(report, report_desc,report_size);189 assert(*report_desc != NULL); 190 191 rc = usb_hid_parse_report_descriptor(report, *report_desc, *report_size); 192 192 if (rc != EOK) { 193 193 usb_log_error("Problem parsing Report descriptor: %s.\n", 194 194 str_error(rc)); 195 free(report_desc); 195 free(*report_desc); 196 *report_desc = NULL; 196 197 return rc; 197 198 } 198 199 199 200 usb_hid_descriptor_print(report); 200 free(report_desc);201 201 202 202 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.