Changeset b9e3aa3 in mainline for uspace/lib
- Timestamp:
- 2011-05-30T14:13:53Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f3f9733
- Parents:
- 2002595 (diff), 8357fc9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib
- Files:
-
- 11 edited
-
drv/generic/driver.c (modified) (1 diff)
-
drv/include/remote_pci.h (modified) (1 diff)
-
drv/include/remote_usb.h (modified) (1 diff)
-
drv/include/remote_usbhc.h (modified) (1 diff)
-
drv/include/usbhc_iface.h (modified) (1 diff)
-
usbdev/include/usb/dev/driver.h (modified) (1 diff)
-
usbdev/src/devdrv.c (modified) (1 diff)
-
usbdev/src/hub.c (modified) (1 diff)
-
usbhid/src/hiddescriptor.c (modified) (4 diffs)
-
usbhid/src/hidparser.c (modified) (9 diffs)
-
usbhid/src/hidpath.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/driver.c
r2002595 rb9e3aa3 405 405 /* The interface has not such method */ 406 406 printf("%s: driver_connection_gen error - " 407 "invalid interface method (%d).\n", 407 "invalid interface method " 408 "(index %" PRIun ").\n", 408 409 driver->name, iface_method_idx); 409 410 async_answer_0(callid, ENOTSUP); -
uspace/lib/drv/include/remote_pci.h
r2002595 rb9e3aa3 36 36 #define LIBDRV_REMOTE_PCI_H_ 37 37 38 remote_iface_t remote_pci_iface;38 extern remote_iface_t remote_pci_iface; 39 39 40 40 #endif -
uspace/lib/drv/include/remote_usb.h
r2002595 rb9e3aa3 36 36 #define LIBDRV_REMOTE_USB_H_ 37 37 38 remote_iface_t remote_usb_iface;38 extern remote_iface_t remote_usb_iface; 39 39 40 40 #endif -
uspace/lib/drv/include/remote_usbhc.h
r2002595 rb9e3aa3 36 36 #define LIBDRV_REMOTE_USBHC_H_ 37 37 38 remote_iface_t remote_usbhc_iface;38 extern remote_iface_t remote_usbhc_iface; 39 39 40 40 #endif -
uspace/lib/drv/include/usbhc_iface.h
r2002595 rb9e3aa3 212 212 /** USB host controller communication interface. */ 213 213 typedef struct { 214 int (*reserve_default_address)(ddf_fun_t *, usb_speed_t);215 int (*release_default_address)(ddf_fun_t *);216 214 int (*request_address)(ddf_fun_t *, usb_speed_t, usb_address_t *); 217 215 int (*bind_address)(ddf_fun_t *, usb_address_t, devman_handle_t); -
uspace/lib/usbdev/include/usb/dev/driver.h
r2002595 rb9e3aa3 168 168 int usb_device_destroy_pipes(ddf_dev_t *, usb_endpoint_mapping_t *, size_t); 169 169 int usb_device_create(ddf_dev_t *, usb_endpoint_description_t **, usb_device_t **, const char **); 170 void usb_device_destroy(usb_device_t *); 170 171 171 172 size_t usb_interface_count_alternates(uint8_t *, size_t, uint8_t); -
uspace/lib/usbdev/src/devdrv.c
r2002595 rb9e3aa3 533 533 } 534 534 535 /** Destroy instance of a USB device. 536 * 537 * @param dev Device to be destroyed. 538 */ 539 void usb_device_destroy(usb_device_t *dev) 540 { 541 if (dev == NULL) { 542 return; 543 } 544 545 /* Ignore errors and hope for the best. */ 546 usb_device_destroy_pipes(dev->ddf_dev, dev->pipes, dev->pipes_count); 547 if (dev->descriptors.configuration != NULL) { 548 free(dev->descriptors.configuration); 549 } 550 551 if (dev->alternate_interfaces != NULL) { 552 if (dev->alternate_interfaces->alternatives != NULL) { 553 free(dev->alternate_interfaces->alternatives); 554 } 555 free(dev->alternate_interfaces); 556 } 557 558 free(dev); 559 } 560 535 561 /** 536 562 * @} -
uspace/lib/usbdev/src/hub.c
r2002595 rb9e3aa3 331 331 goto leave_release_free_address; 332 332 } 333 334 usb_hc_connection_close(&hc_conn); 333 335 334 336 /* -
uspace/lib/usbhid/src/hiddescriptor.c
r2002595 rb9e3aa3 187 187 188 188 field = malloc(sizeof(usb_hid_report_field_t)); 189 if(field == NULL) { 190 return ENOMEM; 191 } 192 189 193 memset(field, 0, sizeof(usb_hid_report_field_t)); 190 194 list_initialize(&field->link); … … 216 220 } 217 221 else { 218 usage = report_item->usages[222 usage = report_item->usages[ 219 223 report_item->usages_count- 1]; 220 224 } … … 241 245 242 246 field->size = report_item->size; 243 244 size_t offset_byte = (report_item->offset + (i * 245 report_item->size)) / 8; 246 247 size_t offset_bit = 8 - ((report_item->offset + (i * 248 report_item->size)) % 8) - report_item->size; 249 250 field->offset = 8 * offset_byte + offset_bit; 251 if(report_item->id != 0) { 247 248 if(report_item->type == USB_HID_REPORT_TYPE_INPUT) { 249 int offset = report_item->offset + report_item->size * i; 250 int field_offset = (offset/8)*8 + (offset/8 + 1) * 8 - 251 offset - report_item->size; 252 if(field_offset < 0) { 253 field->offset = 0; 254 } 255 else { 256 field->offset = field_offset; 257 } 258 } 259 else { 260 field->offset = report_item->offset + (i * report_item->size); 261 } 262 263 264 if(report->use_report_ids != 0) { 252 265 field->offset += 8; 253 266 report->use_report_ids = 1; 254 267 } 268 255 269 field->item_flags = report_item->item_flags; 256 270 … … 322 336 usb_hid_report_description_t, link); 323 337 324 if((report_des->report_id == report_id) && 338 // if report id not set, return the first of the type 339 if(((report_des->report_id == report_id) || (report_id == 0)) && 325 340 (report_des->type == type)) { 326 341 return report_des; -
uspace/lib/usbhid/src/hidparser.c
r2002595 rb9e3aa3 153 153 154 154 155 report_des = usb_hid_report_find_description(report, *report_id, type); 155 report_des = usb_hid_report_find_description(report, *report_id, 156 type); 157 156 158 if(report_des == NULL) { 157 159 return EINVAL; … … 167 169 if(USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) { 168 170 169 if(USB_HID_ITEM_FLAG_VARIABLE(item->item_flags) == 0) {171 if(USB_HID_ITEM_FLAG_VARIABLE(item->item_flags) == 0){ 170 172 171 173 // array … … 174 176 175 177 item->usage = USB_HID_EXTENDED_USAGE( 176 item->usages[item->value - item->physical_minimum]); 177 178 item->usage_page = USB_HID_EXTENDED_USAGE_PAGE( 179 item->usages[item->value - item->physical_minimum]); 180 181 usb_hid_report_set_last_item (item->collection_path, 182 USB_HID_TAG_CLASS_GLOBAL, item->usage_page); 183 184 usb_hid_report_set_last_item (item->collection_path, 178 item->usages[ 179 item->value - item->physical_minimum]); 180 181 item->usage_page = 182 USB_HID_EXTENDED_USAGE_PAGE( 183 item->usages[ 184 item->value - item->physical_minimum]); 185 186 usb_hid_report_set_last_item ( 187 item->collection_path, 188 USB_HID_TAG_CLASS_GLOBAL, 189 item->usage_page); 190 191 usb_hid_report_set_last_item ( 192 item->collection_path, 185 193 USB_HID_TAG_CLASS_LOCAL, item->usage); 186 194 … … 188 196 else { 189 197 // variable item 190 item->value = usb_hid_translate_data(item, data); 191 } 198 item->value = usb_hid_translate_data(item, 199 data); 200 } 192 201 } 193 202 list_item = list_item->next; … … 213 222 214 223 int32_t value=0; 215 int32_t mask ;216 const uint8_t *foo ;224 int32_t mask=0; 225 const uint8_t *foo=0; 217 226 218 227 // now only shot tags are allowed … … 240 249 if((size_t)(offset/8) != (size_t)((offset+item->size-1)/8)) { 241 250 242 part_size = ((offset+item->size)%8);251 part_size = 0; 243 252 244 253 size_t i=0; … … 246 255 if(i == (size_t)(offset/8)) { 247 256 // the higher one 257 part_size = 8 - (offset % 8); 248 258 foo = data + i; 249 259 mask = ((1 << (item->size-part_size))-1); 250 value = (*foo & mask) << part_size;260 value = (*foo & mask); 251 261 } 252 262 else if(i == ((offset+item->size-1)/8)){ 253 263 // the lower one 254 264 foo = data + i; 255 mask = ((1 << part_size)-1) << (8-part_size); 256 value += ((*foo & mask) >> (8-part_size)); 265 mask = ((1 << (item->size - part_size)) - 1) 266 << (8 - (item->size - part_size)); 267 268 value = (((*foo & mask) >> (8 - 269 (item->size - part_size))) << part_size ) 270 + value; 257 271 } 258 272 else { 259 value = value << 8;260 value += *(data + 1);273 value = (*(data + 1) << (part_size + 8)) + value; 274 part_size += 8; 261 275 } 262 276 } … … 375 389 report_item = list_get_instance(item, usb_hid_report_field_t, link); 376 390 377 if(USB_HID_ITEM_FLAG_VARIABLE(report_item->item_flags) == 0) { 378 379 // array 380 value = usb_hid_translate_data_reverse(report_item, 381 report_item->value); 382 383 offset = report_item->offset; 384 length = report_item->size; 385 } 386 else { 387 // variable item 388 value = usb_hid_translate_data_reverse(report_item, 389 report_item->value); 390 391 offset = report_item->offset; 392 length = report_item->size; 393 } 394 391 value = usb_hid_translate_data_reverse(report_item, 392 report_item->value); 393 394 offset = report_des->bit_length - report_item->offset - 1; 395 length = report_item->size; 396 395 397 usb_log_debug("\ttranslated value: %x\n", value); 396 398 … … 617 619 return report_des->report_id; 618 620 } 621 622 report_it = report_it->next; 619 623 } 620 624 -
uspace/lib/usbhid/src/hidpath.c
r2002595 rb9e3aa3 211 211 212 212 if(report_path->report_id != path->report_id) { 213 return 1; 213 if(path->report_id != 0) { 214 return 1; 215 } 214 216 } 215 217
Note:
See TracChangeset
for help on using the changeset viewer.
