Changes in uspace/lib/usbhid/src/hidpath.c [9d58539:07525cd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhid/src/hidpath.c
r9d58539 r07525cd 41 41 #include <assert.h> 42 42 43 /*---------------------------------------------------------------------------*/ 43 44 44 /** 45 45 * Compares two usages if they are same or not or one of the usages is not … … 63 63 ((page1 == page2) || (page1 == 0) || (page2 == 0)) 64 64 65 /*---------------------------------------------------------------------------*/ 65 66 66 /** 67 67 * Appends one item (couple of usage_path and usage) into the usage path … … 93 93 } 94 94 95 /*---------------------------------------------------------------------------*/ 95 96 96 /** 97 97 * Removes last item from the usage path structure … … 114 114 } 115 115 116 /*---------------------------------------------------------------------------*/ 116 117 117 /** 118 118 * Nulls last item of the usage path structure. … … 133 133 } 134 134 135 /*---------------------------------------------------------------------------*/ 135 136 136 /** 137 137 * Modifies last item of usage path structure by given usage page or usage … … 164 164 } 165 165 166 /*---------------------------------------------------------------------------*/ 166 167 167 /** 168 168 * … … 176 176 usb_log_debug("\tLENGTH: %d\n", path->depth); 177 177 178 usb_hid_report_usage_path_t *path_item; 179 180 list_foreach(path->items, item) { 181 path_item = list_get_instance(item, usb_hid_report_usage_path_t, 182 rpath_items_link); 178 list_foreach(path->items, rpath_items_link, 179 usb_hid_report_usage_path_t, path_item) { 183 180 184 181 usb_log_debug("\tUSAGE_PAGE: %X\n", path_item->usage_page); … … 188 185 } 189 186 190 /*---------------------------------------------------------------------------*/ 187 191 188 /** 192 189 * Compares two usage paths structures … … 237 234 usb_hid_report_usage_path_t, rpath_items_link); 238 235 239 list_foreach(report_path->items, report_link) { 240 report_item = list_get_instance(report_link, 241 usb_hid_report_usage_path_t, rpath_items_link); 236 list_foreach(report_path->items, rpath_items_link, 237 usb_hid_report_usage_path_t, report_item) { 238 239 if (USB_HID_SAME_USAGE_PAGE(report_item->usage_page, 240 path_item->usage_page)) { 242 241 243 if(USB_HID_SAME_USAGE_PAGE(report_item->usage_page, 244 path_item->usage_page)){ 245 246 if(only_page == 0){ 247 if(USB_HID_SAME_USAGE( 248 report_item->usage, 249 path_item->usage)) { 250 242 if (only_page == 0) { 243 if (USB_HID_SAME_USAGE(report_item->usage, 244 path_item->usage)) 251 245 return EOK; 252 }253 246 } 254 247 else { … … 266 259 return 1; 267 260 } 268 261 269 262 /* path is prefix of the report_path */ 270 263 case USB_HID_PATH_COMPARE_BEGIN: 271 264 272 265 report_link = report_path->items.head.next; 273 266 path_link = path->items.head.next; 267 268 while ((report_link != &report_path->items.head) && 269 (path_link != &path->items.head)) { 274 270 275 while((report_link != &report_path->items.head) &&276 (path_link != &path->items.head)) {277 278 271 report_item = list_get_instance(report_link, 279 280 272 usb_hid_report_usage_path_t, rpath_items_link); 273 281 274 path_item = list_get_instance(path_link, 282 275 usb_hid_report_usage_path_t, rpath_items_link); 283 276 284 if (!USB_HID_SAME_USAGE_PAGE(report_item->usage_page,285 277 if (!USB_HID_SAME_USAGE_PAGE(report_item->usage_page, 278 path_item->usage_page) || ((only_page == 0) && 286 279 !USB_HID_SAME_USAGE(report_item->usage, 287 path_item->usage))) { 288 280 path_item->usage))) { 289 281 return 1; 290 } 291 else { 282 } else { 292 283 report_link = report_link->next; 293 path_link = path_link->next; 284 path_link = path_link->next; 294 285 } 295 296 } 297 298 if((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) && 299 (path_link == &path->items.head)) || 300 ((report_link == &report_path->items.head) && 301 (path_link == &path->items.head))) { 302 286 } 287 288 if ((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) && 289 (path_link == &path->items.head)) || 290 ((report_link == &report_path->items.head) && 291 (path_link == &path->items.head))) { 303 292 return EOK; 304 } 305 else { 293 } else { 306 294 return 1; 307 } 295 } 308 296 break; 309 297 … … 354 342 } 355 343 356 /*---------------------------------------------------------------------------*/ 344 357 345 /** 358 346 * Allocates and initializes new usage path structure. … … 376 364 } 377 365 378 /*---------------------------------------------------------------------------*/ 366 379 367 /** 380 368 * Releases given usage path structure. … … 395 383 } 396 384 397 /*---------------------------------------------------------------------------*/ 385 398 386 /** 399 387 * Clone content of given usage path to the new one … … 405 393 usb_hid_report_path_t *usage_path) 406 394 { 407 usb_hid_report_usage_path_t *path_item;408 395 usb_hid_report_usage_path_t *new_path_item; 409 396 usb_hid_report_path_t *new_usage_path = usb_hid_report_path (); … … 419 406 } 420 407 421 list_foreach(usage_path->items, path_link) { 422 path_item = list_get_instance(path_link, 423 usb_hid_report_usage_path_t, rpath_items_link); 408 list_foreach(usage_path->items, rpath_items_link, 409 usb_hid_report_usage_path_t, path_item) { 424 410 425 411 new_path_item = malloc(sizeof(usb_hid_report_usage_path_t)); … … 441 427 } 442 428 443 /*---------------------------------------------------------------------------*/ 429 444 430 /** 445 431 * Sets report id in usage path structure
Note:
See TracChangeset
for help on using the changeset viewer.