Changeset 64dbc83 in mainline
- Timestamp:
- 2011-04-05T19:33:11Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b04967a, fee6381
- Parents:
- a9974ef
- Location:
- uspace/lib/usb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/classes/hidparser.h
ra9974ef r64dbc83 92 92 /** */ 93 93 link_t link; 94 94 95 } usb_hid_report_path_t; 95 96 … … 158 159 159 160 int use_report_id; 160 161 162 /** */ 163 link_t stack; 161 164 } usb_hid_report_parser_t; 162 165 -
uspace/lib/usb/src/hidparser.c
ra9974ef r64dbc83 64 64 int usb_hid_report_reset_local_items(); 65 65 void usb_hid_free_report_list(link_t *head); 66 66 usb_hid_report_item_t *usb_hid_report_item_clone(const usb_hid_report_item_t *item); 67 67 /* 68 68 * Data translation private functions … … 105 105 list_initialize(&(parser->output)); 106 106 list_initialize(&(parser->feature)); 107 108 list_initialize(&(parser->stack)); 107 109 108 110 parser->use_report_id = 0; … … 222 224 } 223 225 memcpy(new_report_item,report_item, sizeof(usb_hid_report_item_t)); 226 link_initialize(&(new_report_item->link)); 224 227 225 228 /* reset local items */ 226 229 new_report_item->usage_minimum = 0; 227 230 new_report_item->usage_maximum = 0; 228 new_report_item->usage = 0;229 231 new_report_item->designator_index = 0; 230 232 new_report_item->designator_minimum = 0; … … 232 234 new_report_item->string_index = 0; 233 235 new_report_item->string_minimum = 0; 234 new_report_item->string_maximum = 0; 236 new_report_item->string_maximum = 0; 237 238 /* reset usage from current usage path */ 239 usb_hid_report_usage_path_t *path = list_get_instance(&usage_path->link, usb_hid_report_usage_path_t, link); 240 path->usage = 0; 235 241 236 link_initialize(&(new_report_item->link));237 242 report_item = new_report_item; 238 243 … … 240 245 case USB_HID_REPORT_TAG_PUSH: 241 246 // push current state to stack 242 // not yet implemented 247 new_report_item = usb_hid_report_item_clone(report_item); 248 list_prepend (&parser->stack, &new_report_item->link); 249 243 250 break; 244 251 case USB_HID_REPORT_TAG_POP: 245 252 // restore current state from stack 246 // not yet implemented 253 if(list_empty (&parser->stack)) { 254 return EINVAL; 255 } 256 257 report_item = list_get_instance(&parser->stack, usb_hid_report_item_t, link); 258 list_remove (parser->stack.next); 259 247 260 break; 248 261 … … 1371 1384 } 1372 1385 1386 1387 usb_hid_report_item_t *usb_hid_report_item_clone(const usb_hid_report_item_t *item) 1388 { 1389 usb_hid_report_item_t *new_report_item; 1390 1391 if(!(new_report_item = malloc(sizeof(usb_hid_report_item_t)))) { 1392 return NULL; 1393 } 1394 memcpy(new_report_item,item, sizeof(usb_hid_report_item_t)); 1395 link_initialize(&(new_report_item->link)); 1396 1397 return new_report_item; 1398 } 1399 1373 1400 /** 1374 1401 * @}
Note:
See TracChangeset
for help on using the changeset viewer.