Changeset 777e336 in mainline for uspace/drv/usbhid/usbhid.c
- Timestamp:
- 2011-04-12T15:59:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e7df6cd
- Parents:
- 1cbb4b7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/usbhid.c
r1cbb4b7 r777e336 164 164 165 165 static bool usb_hid_path_matches(usb_hid_dev_t *hid_dev, 166 const usb_hid_subdriver_usage_t *path, int path_size, intcompare)166 const usb_hid_subdriver_usage_t *path, int compare) 167 167 { 168 168 assert(hid_dev != NULL); … … 174 174 return false; 175 175 } 176 int i ;177 for (i = 0; i < path_size; ++i) {176 int i = 0; 177 while (path[i].usage != 0 || path[i].usage_page != 0) { 178 178 if (usb_hid_report_path_append_item(usage_path, 179 179 path[i].usage_page, path[i].usage) != EOK) { … … 182 182 return false; 183 183 } 184 ++i; 184 185 } 185 186 … … 238 239 while (count < USB_HID_MAX_SUBDRIVERS && 239 240 (mapping->usage_path != NULL 240 || mapping->vendor_id != NULL 241 || mapping->product_id != NULL)) { 241 || mapping->vendor_id != 0 || mapping->product_id != 0)) { 242 242 // check the vendor & product ID 243 if (mapping->vendor_id != NULL && mapping->product_id == NULL) {244 usb_log_warning("Missing Product ID for Vendor ID % s\n",243 if (mapping->vendor_id != 0 && mapping->product_id == 0) { 244 usb_log_warning("Missing Product ID for Vendor ID %u\n", 245 245 mapping->vendor_id); 246 246 return EINVAL; 247 247 } 248 if (mapping->product_id != NULL && mapping->vendor_id == NULL) {249 usb_log_warning("Missing Vendor ID for Product ID % s\n",248 if (mapping->product_id != 0 && mapping->vendor_id == 0) { 249 usb_log_warning("Missing Vendor ID for Product ID %u\n", 250 250 mapping->product_id); 251 251 return EINVAL; 252 252 } 253 253 254 if (mapping->vendor_id != NULL) {255 assert(mapping->product_id != NULL);256 usb_log_debug("Comparing device against vendor ID % s"257 " and product ID % s.\n", mapping->vendor_id,254 if (mapping->vendor_id != 0) { 255 assert(mapping->product_id != 0); 256 usb_log_debug("Comparing device against vendor ID %u" 257 " and product ID %u.\n", mapping->vendor_id, 258 258 mapping->product_id); 259 259 if (usb_hid_ids_match(hid_dev, mapping)) { … … 268 268 usb_log_debug("Comparing device against usage path.\n"); 269 269 if (usb_hid_path_matches(hid_dev, 270 mapping->usage_path, mapping->path_size, 271 mapping->compare)) { 270 mapping->usage_path, mapping->compare)) { 272 271 subdrivers[count++] = &mapping->subdriver; 273 272 } else {
Note:
See TracChangeset
for help on using the changeset viewer.