Changeset 45019865 in mainline
- Timestamp:
- 2011-01-14T13:35:14Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0a9ea4a
- Parents:
- f401312
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbkbd/descdump.c
rf401312 r45019865 125 125 printf(INDENT "bCountryCode = %d\n", d->country_code); 126 126 printf(INDENT "bNumDescriptors = %d\n", d->class_desc_count); 127 printf(INDENT "bDescriptorType = %d\n", d->report_desc_info.type); 128 printf(INDENT "wDescriptorLength = %d\n", d->report_desc_info.length); 127 129 } 128 130 -
uspace/drv/usbkbd/descparser.c
rf401312 r45019865 52 52 free(config->interfaces[i].endpoints); 53 53 } 54 if (iface->class_desc_info != NULL) {54 /*if (iface->class_desc_info != NULL) { 55 55 free(iface->class_desc_info); 56 56 } … … 64 64 } 65 65 } 66 } 66 }*/ 67 67 } 68 68 … … 152 152 } 153 153 ep_i = 0; 154 155 printf("Remaining size: %d\n", size - (size_t)(pos - data)); 154 156 155 157 break; … … 184 186 break; 185 187 case USB_DESCTYPE_HID: 186 if (desc_size < sizeof(usb_standard_hid_descriptor_t) 187 + sizeof(usb_standard_hid_class_descriptor_info_t)) { 188 if (desc_size < sizeof(usb_standard_hid_descriptor_t)) { 189 printf("Wrong size of descriptor: %d (should be %d)\n", 190 desc_size, sizeof(usb_standard_hid_descriptor_t)); 188 191 ret = EINVAL; 189 192 goto end; … … 195 198 pos += sizeof(usb_standard_hid_descriptor_t); 196 199 197 if (actual_iface->hid_desc.class_desc_count200 /*if (actual_iface->hid_desc.class_desc_count 198 201 * sizeof(usb_standard_hid_class_descriptor_info_t) 199 202 != desc_size … … 203 206 ret = EINVAL; 204 207 goto end; 205 } 208 }*/ 206 209 207 210 printf("Parsed HID descriptor header: \n"); … … 209 212 210 213 // allocate space for all class-specific descriptor info 211 actual_iface->class_desc_info =214 /*actual_iface->class_desc_info = 212 215 (usb_standard_hid_class_descriptor_info_t *)malloc( 213 216 actual_iface->hid_desc.class_desc_count … … 216 219 ret = ENOMEM; 217 220 goto end; 218 } 221 }*/ 219 222 220 223 // allocate space for all class-specific descriptors … … 317 320 dump_standard_hid_descriptor_header(&iface_d->hid_desc); 318 321 printf("\n"); 322 dump_hid_class_descriptor(0, USB_DESCTYPE_HID_REPORT, 323 iface_d->report_desc, iface_d->hid_desc.report_desc_info.length); 324 printf("\n"); 319 325 // printf("%d class-specific descriptors\n", 320 326 // iface_d->hid_desc.class_desc_count); 321 for (j = 0; j < iface_d->hid_desc.class_desc_count; ++j) {327 /*for (j = 0; j < iface_d->hid_desc.class_desc_count; ++j) { 322 328 dump_standard_hid_class_descriptor_info( 323 329 &iface_d->class_desc_info[j]); … … 329 335 iface_d->class_descs[j], 330 336 iface_d->class_desc_info[j].length); 331 } 337 }*/ 332 338 } 333 339 } -
uspace/drv/usbkbd/main.c
rf401312 r45019865 39 39 #include <usb/descriptor.h> 40 40 #include "descparser.h" 41 #include "descdump.h" 41 42 42 43 #define BUFFER_SIZE 32 … … 109 110 unsigned i; 110 111 for (i = 0; i < kbd_dev->conf->config_descriptor.interface_count; ++i) { 111 uint8_t type =112 kbd_dev->conf->interfaces[i].hid_desc.report_desc_info.type;113 112 // TODO: endianness 114 113 uint16_t length = 115 114 kbd_dev->conf->interfaces[i].hid_desc.report_desc_info.length; 115 size_t actual_size = 0; 116 116 117 117 // allocate space for the report descriptor 118 118 kbd_dev->conf->interfaces[i].report_desc = (uint8_t *)malloc(length); 119 119 120 // get the descriptor from the device 120 121 } 121 int rc = usb_drv_req_get_descriptor(kbd_dev->device->parent_phone, 122 kbd_dev->address, USB_REQUEST_TYPE_CLASS, USB_DESCTYPE_HID_REPORT, 123 0, i, kbd_dev->conf->interfaces[i].report_desc, length, 124 &actual_size); 125 126 if (rc != EOK) { 127 return rc; 128 } 129 130 assert(actual_size == length); 131 132 dump_hid_class_descriptor(0, USB_DESCTYPE_HID_REPORT, 133 kbd_dev->conf->interfaces[i].report_desc, length); 134 } 135 136 return EOK; 122 137 } 123 138 … … 162 177 rc = usbkbd_parse_descriptors(descriptors, transferred, kbd_dev->conf); 163 178 free(descriptors); 179 if (rc != EOK) { 180 printf("Problem with parsing standard descriptors.\n"); 181 return rc; 182 } 164 183 165 184 // get and report descriptors 166 185 rc = usbkbd_get_report_descriptor(kbd_dev); 186 if (rc != EOK) { 187 printf("Problem with parsing HID REPORT descriptor.\n"); 188 return rc; 189 } 167 190 168 191 usbkbd_print_config(kbd_dev->conf); 169 192 170 return rc;193 return EOK; 171 194 } 172 195 -
uspace/lib/usb/include/usb/classes/hid.h
rf401312 r45019865 98 98 uint8_t class_desc_count; 99 99 /** First mandatory class descriptor (Report) info. */ 100 usb_standard_hid_ descriptor_class_item_t report_desc_info;100 usb_standard_hid_class_descriptor_info_t report_desc_info; 101 101 } __attribute__ ((packed)) usb_standard_hid_descriptor_t; 102 102
Note:
See TracChangeset
for help on using the changeset viewer.