|
124 | 124 | # MTP struct definitions using uctypes
|
125 | 125 | # Container header struct
|
126 | 126 | _MTP_CONTAINER_HEADER_DESC = {
|
127 |
| - "length": (0, uctypes.UINT32), |
128 |
| - "type": (4, uctypes.UINT16), |
129 |
| - "code": (6, uctypes.UINT16), |
130 |
| - "transaction_id": (8, uctypes.UINT32) |
| 127 | + "length": 0 | uctypes.UINT32, |
| 128 | + "type": 4 | uctypes.UINT16, |
| 129 | + "code": 6 | uctypes.UINT16, |
| 130 | + "transaction_id": 8 | uctypes.UINT32 |
131 | 131 | }
|
132 | 132 |
|
133 | 133 | # Device Info struct
|
134 | 134 | _MTP_DEVICE_INFO_DESC = {
|
135 |
| - "standard_version": (0, uctypes.UINT16), |
136 |
| - "vendor_extension_id": (2, uctypes.UINT32), |
137 |
| - "mtp_version": (6, uctypes.UINT16), |
| 135 | + "standard_version": 0 | uctypes.UINT16, |
| 136 | + "vendor_extension_id": 2 | uctypes.UINT32, |
| 137 | + "mtp_version": 6 | uctypes.UINT16, |
138 | 138 | # Variable length data follows: extension string, operations, events, etc.
|
139 | 139 | }
|
140 | 140 |
|
141 | 141 | # Storage IDs struct
|
142 | 142 | _MTP_STORAGE_IDS_DESC = {
|
143 |
| - "count": (0, uctypes.UINT32), |
144 |
| - "storage_ids": (4, uctypes.ARRAY, 1, uctypes.UINT32) # Variable length array |
| 143 | + "count": 0 | uctypes.UINT32, |
| 144 | + "storage_ids": (4 | uctypes.ARRAY, 1 | uctypes.UINT32) # Variable length array |
145 | 145 | }
|
146 | 146 |
|
147 | 147 | # Storage Info struct
|
148 | 148 | _MTP_STORAGE_INFO_DESC = {
|
149 |
| - "storage_type": (0, uctypes.UINT16), |
150 |
| - "filesystem_type": (2, uctypes.UINT16), |
151 |
| - "access_capability": (4, uctypes.UINT16), |
152 |
| - "max_capacity": (6, uctypes.UINT64), |
153 |
| - "free_space": (14, uctypes.UINT64), |
154 |
| - "free_space_objects": (22, uctypes.UINT32) |
| 149 | + "storage_type": 0 | uctypes.UINT16, |
| 150 | + "filesystem_type": 2 | uctypes.UINT16, |
| 151 | + "access_capability": 4 | uctypes.UINT16, |
| 152 | + "max_capacity": 6 | uctypes.UINT64, |
| 153 | + "free_space": 14 | uctypes.UINT64, |
| 154 | + "free_space_objects": 22 | uctypes.UINT32 |
155 | 155 | # Variable length data follows: storage_description, volume_identifier
|
156 | 156 | }
|
157 | 157 |
|
158 | 158 | # Object Handles struct
|
159 | 159 | _MTP_OBJECT_HANDLES_DESC = {
|
160 |
| - "count": (0, uctypes.UINT32), |
161 |
| - "handles": (4, uctypes.ARRAY, 1, uctypes.UINT32) # Variable length array |
| 160 | + "count": 0 | uctypes.UINT32, |
| 161 | + "handles": (4 | uctypes.ARRAY, 1 | uctypes.UINT32) # Variable length array |
162 | 162 | }
|
163 | 163 |
|
164 | 164 |
|
@@ -783,8 +783,8 @@ def _cmd_get_object_handles(self, params):
|
783 | 783 | # For the _MTP_OBJECT_HANDLES_DESC, we need to dynamically adjust the array size
|
784 | 784 | # Create a custom descriptor with the actual array size
|
785 | 785 | obj_handles_desc = {
|
786 |
| - "count": (0, uctypes.UINT32), |
787 |
| - "handles": (4, uctypes.ARRAY, len(handles), uctypes.UINT32) |
| 786 | + "count": 0 | uctypes.UINT32, |
| 787 | + "handles": (4 | uctypes.ARRAY, len(handles) | uctypes.UINT32) |
788 | 788 | }
|
789 | 789 |
|
790 | 790 | # Create the struct
|
|
0 commit comments