114
114
_MTP_STORAGE_READ_ONLY_WITH_DELETE = const (0x0002 )
115
115
116
116
# Maximum sizes and buffers
117
- _MAX_PACKET_SIZE = const (512 )
117
+ # _MAX_PACKET_SIZE = const(512)
118
+ _MAX_PACKET_SIZE = const (64 )
118
119
_DEFAULT_TX_BUF_SIZE = const (4096 )
119
120
_DEFAULT_RX_BUF_SIZE = const (4096 )
120
121
_CONTAINER_HEADER_SIZE = const (12 )
@@ -172,14 +173,17 @@ def __init__(self, storage_path="/", rx_size=_DEFAULT_RX_BUF_SIZE, tx_size=_DEFA
172
173
def desc_cfg (self , desc , itf_num , ep_num , strs ):
173
174
"""Build the USB configuration descriptor for this interface."""
174
175
print ("[MTP] Building descriptors: itf_num={}, ep_num={}" .format (itf_num , ep_num ))
176
+ i_interface = len (strs )
177
+ strs .append ("MTP" )
178
+
175
179
# Add the interface descriptor for MTP (PIMA 15740 Still Image)
176
180
desc .interface (
177
181
itf_num ,
178
182
3 , # Number of endpoints (1 bulk IN, 1 bulk OUT, 1 interrupt IN)
179
183
_INTERFACE_CLASS_STILL_IMAGE ,
180
184
_INTERFACE_SUBCLASS_STILL_IMAGE ,
181
185
_INTERFACE_PROTOCOL_PIMA_15740 ,
182
- 0 , # No string descriptor
186
+ i_interface ,
183
187
)
184
188
185
189
# Add the endpoints (bulk OUT, bulk IN, interrupt IN)
@@ -196,7 +200,7 @@ def desc_cfg(self, desc, itf_num, ep_num, strs):
196
200
197
201
def num_eps (self ):
198
202
"""Return the number of endpoints used by this interface."""
199
- return 2 # We use 2 endpoint numbers (3 endpoints total with IN flag)
203
+ return 3 # We use 2 endpoint numbers (3 endpoints total with IN flag)
200
204
201
205
def on_open (self ):
202
206
"""Called when the USB host configures the device."""
0 commit comments