Last active
July 7, 2023 17:54
-
-
Save tannewt/8e463586cea34e1b5a01e4826059cc4b to your computer and use it in GitHub Desktop.
Revisions
-
tannewt revised this gist
Jul 7, 2023 . 1 changed file with 41 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ meta: id: usb_hid file-extension: usb_hid bit-endian: le endian: le seq: - id: items type: item @@ -34,15 +36,20 @@ types: type: u1 - id: data size: b_data_size unknown_short_item: seq: - id: data size: _parent._parent.b_size == 0 ? 0 : (1 << (_parent._parent.b_size - 1)) short_item: seq: - id: item type: switch-on: _parent.b_type cases: 'item_type::main': main_item 'item_type::local': local_item 'item_type::global': global_item _: unknown_short_item main_item: seq: - id: item @@ -62,6 +69,8 @@ types: type: u1 - id: subitems type: item # repeat: expr # repeat-expr: 10 repeat: until repeat-until: _.b_type == item_type::main and _.b_tag == 0xc @@ -72,10 +81,38 @@ types: seq: - id: data type: b1 - type: b7 field_item: seq: - id: field type: field_attributes #size: _parent._parent._parent.b_size == 0 ? 0 : (1 << (_parent._parent._parent.b_size - 1)) usage_item: seq: - id: usage type: u1 usage_page_item: seq: - id: usage type: u2 local_item: seq: - id: item size: _parent._parent.b_size == 0 ? 0 : (1 << (_parent._parent.b_size - 1)) type: switch-on: _parent._parent.b_tag cases: 0x0: usage_item global_item: seq: - id: item size: _parent._parent.b_size == 0 ? 0 : (1 << (_parent._parent.b_size - 1)) type: switch-on: _parent._parent.b_tag cases: 0x0: usage_page_item -
tannewt created this gist
Jul 7, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,81 @@ meta: id: usb_hid file-extension: usb_hid seq: - id: items type: item repeat: eos enums: item_type: 0: main 1: global 2: local types: item: seq: - id: b_size type: b2 - id: b_type type: b2 enum: item_type - id: b_tag type: b4 - id: data type: switch-on: b_tag cases: 0xff: long_item _: short_item long_item: seq: - id: b_data_size type: u1 - id: b_long_item_tag type: u1 - id: data size: b_data_size short_item: seq: - id: item type: switch-on: _parent.b_type cases: 'item_type::main': main_item # 'item_type::local': local_item # 'item_type::global': global_item main_item: seq: - id: item type: switch-on: _parent._parent.b_tag cases: 0x8: field_item 0x9: field_item 0xB: field_item 0xA: collection_item 0xC: end_collection_item collection_item: seq: - id: collection_type # type: collection_type type: u1 - id: subitems type: item repeat: until repeat-until: _.b_type == item_type::main and _.b_tag == 0xc end_collection_item: doc: no data field_attributes: seq: - id: data type: b1 field_item: seq: - id: field type: field_attributes size: _parent._parent._parent.b_size == 0 ? 0 : (1 << (_parent._parent._parent.b_size - 1))