Changeset f3b39b4 in mainline for uspace/lib/usbhid/src/hidpath.c
- Timestamp:
- 2011-05-26T20:43:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d861c22
- Parents:
- 14e1bcc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhid/src/hidpath.c
r14e1bcc rf3b39b4 225 225 226 226 switch(flags){ 227 /* path is somewhere in report_path */ 228 case USB_HID_PATH_COMPARE_ANYWHERE: 229 if(path->depth != 1){ 230 return 1; 231 } 232 233 report_link = report_path->head.next; 234 path_link = path->head.next; 235 path_item = list_get_instance(path_link, 227 /* path is somewhere in report_path */ 228 case USB_HID_PATH_COMPARE_ANYWHERE: 229 if(path->depth != 1){ 230 return 1; 231 } 232 233 report_link = report_path->head.next; 234 path_link = path->head.next; 235 path_item = list_get_instance(path_link, 236 usb_hid_report_usage_path_t, link); 237 238 while(report_link != &report_path->head) { 239 report_item = list_get_instance(report_link, 236 240 usb_hid_report_usage_path_t, link); 237 238 while(report_link != &report_path->head) {239 report_item = list_get_instance(report_link,240 usb_hid_report_usage_path_t, link);241 241 242 243 242 if(USB_HID_SAME_USAGE_PAGE(report_item->usage_page, 243 path_item->usage_page)){ 244 244 245 if(only_page == 0){ 246 if(USB_HID_SAME_USAGE(report_item->usage, 247 path_item->usage)) { 245 if(only_page == 0){ 246 if(USB_HID_SAME_USAGE( 247 report_item->usage, 248 path_item->usage)) { 248 249 249 return EOK;250 }251 }252 else {253 250 return EOK; 254 251 } 255 252 } 256 253 else { 254 return EOK; 255 } 256 } 257 258 report_link = report_link->next; 259 } 260 261 return 1; 262 break; 263 264 /* the paths must be identical */ 265 case USB_HID_PATH_COMPARE_STRICT: 266 if(report_path->depth != path->depth){ 267 return 1; 268 } 269 270 /* path is prefix of the report_path */ 271 case USB_HID_PATH_COMPARE_BEGIN: 272 273 report_link = report_path->head.next; 274 path_link = path->head.next; 275 276 while((report_link != &report_path->head) && 277 (path_link != &path->head)) { 278 279 report_item = list_get_instance(report_link, 280 usb_hid_report_usage_path_t, link); 281 282 path_item = list_get_instance(path_link, 283 usb_hid_report_usage_path_t, link); 284 285 if(!USB_HID_SAME_USAGE_PAGE(report_item->usage_page, 286 path_item->usage_page) || ((only_page == 0) && 287 !USB_HID_SAME_USAGE(report_item->usage, 288 path_item->usage))) { 289 290 return 1; 291 } 292 else { 257 293 report_link = report_link->next; 294 path_link = path_link->next; 258 295 } 259 260 return 1;261 break;262 /* the paths must be identical */263 case USB_HID_PATH_COMPARE_STRICT:264 if(report_path->depth != path->depth){265 return 1;266 }267 268 /* path is prefix of the report_path */269 case USB_HID_PATH_COMPARE_BEGIN:270 271 report_link = report_path->head.next;272 path_link = path->head.next;273 274 while((report_link != &report_path->head) &&275 (path_link != &path->head)) {276 277 report_item = list_get_instance(report_link,278 usb_hid_report_usage_path_t, link);279 280 path_item = list_get_instance(path_link,281 usb_hid_report_usage_path_t, link);282 283 if(!USB_HID_SAME_USAGE_PAGE(report_item->usage_page,284 path_item->usage_page) || ((only_page == 0) &&285 !USB_HID_SAME_USAGE(report_item->usage,286 path_item->usage))) {287 288 return 1;289 } else {290 report_link = report_link->next;291 path_link = path_link->next;292 }293 296 294 297 } 295 298 296 if((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) && 297 (path_link == &path->head)) || 298 ((report_link == &report_path->head) && 299 (path_link == &path->head))) { 300 301 return EOK; 302 } 303 else { 299 if((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) && 300 (path_link == &path->head)) || 301 ((report_link == &report_path->head) && 302 (path_link == &path->head))) { 303 304 return EOK; 305 } 306 else { 307 return 1; 308 } 309 break; 310 311 /* path is suffix of report_path */ 312 case USB_HID_PATH_COMPARE_END: 313 314 report_link = report_path->head.prev; 315 path_link = path->head.prev; 316 317 if(list_empty(&path->head)){ 318 return EOK; 319 } 320 321 while((report_link != &report_path->head) && 322 (path_link != &path->head)) { 323 324 report_item = list_get_instance(report_link, 325 usb_hid_report_usage_path_t, link); 326 327 path_item = list_get_instance(path_link, 328 usb_hid_report_usage_path_t, link); 329 330 if(!USB_HID_SAME_USAGE_PAGE(report_item->usage_page, 331 path_item->usage_page) || ((only_page == 0) && 332 !USB_HID_SAME_USAGE(report_item->usage, 333 path_item->usage))) { 334 304 335 return 1; 305 } 306 break; 307 308 /* path is suffix of report_path */ 309 case USB_HID_PATH_COMPARE_END: 310 311 report_link = report_path->head.prev; 312 path_link = path->head.prev; 313 314 if(list_empty(&path->head)){ 315 return EOK; 316 } 336 } else { 337 report_link = report_link->prev; 338 path_link = path_link->prev; 339 } 340 341 } 342 343 if(path_link == &path->head) { 344 return EOK; 345 } 346 else { 347 return 1; 348 } 317 349 318 while((report_link != &report_path->head) && 319 (path_link != &path->head)) { 320 321 report_item = list_get_instance(report_link, 322 usb_hid_report_usage_path_t, link); 323 324 path_item = list_get_instance(path_link, 325 usb_hid_report_usage_path_t, link); 326 327 if(!USB_HID_SAME_USAGE_PAGE(report_item->usage_page, 328 path_item->usage_page) || ((only_page == 0) && 329 !USB_HID_SAME_USAGE(report_item->usage, 330 path_item->usage))) { 331 332 return 1; 333 } else { 334 report_link = report_link->prev; 335 path_link = path_link->prev; 336 } 337 338 } 339 340 if(path_link == &path->head) { 341 return EOK; 342 } 343 else { 344 return 1; 345 } 346 347 break; 348 349 default: 350 return EINVAL; 350 break; 351 352 default: 353 return EINVAL; 351 354 } 352 355 } … … 418 421 path_link = usage_path->head.next; 419 422 while(path_link != &usage_path->head) { 420 path_item = list_get_instance(path_link, usb_hid_report_usage_path_t, 421 link); 423 path_item = list_get_instance(path_link, 424 usb_hid_report_usage_path_t, link); 425 422 426 new_path_item = malloc(sizeof(usb_hid_report_usage_path_t)); 423 427 if(new_path_item == NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.