114114_MTP_STORAGE_READ_ONLY_WITH_DELETE = const (0x0002 )
115115
116116# Maximum sizes and buffers
117- _MAX_PACKET_SIZE = const (512 )
117+ # _MAX_PACKET_SIZE = const(512)
118+ _MAX_PACKET_SIZE = const (64 )
118119_DEFAULT_TX_BUF_SIZE = const (4096 )
119120_DEFAULT_RX_BUF_SIZE = const (4096 )
120121_CONTAINER_HEADER_SIZE = const (12 )
@@ -172,14 +173,17 @@ def __init__(self, storage_path="/", rx_size=_DEFAULT_RX_BUF_SIZE, tx_size=_DEFA
172173 def desc_cfg (self , desc , itf_num , ep_num , strs ):
173174 """Build the USB configuration descriptor for this interface."""
174175 print ("[MTP] Building descriptors: itf_num={}, ep_num={}" .format (itf_num , ep_num ))
176+ i_interface = len (strs )
177+ strs .append ("MTP" )
178+
175179 # Add the interface descriptor for MTP (PIMA 15740 Still Image)
176180 desc .interface (
177181 itf_num ,
178182 3 , # Number of endpoints (1 bulk IN, 1 bulk OUT, 1 interrupt IN)
179183 _INTERFACE_CLASS_STILL_IMAGE ,
180184 _INTERFACE_SUBCLASS_STILL_IMAGE ,
181185 _INTERFACE_PROTOCOL_PIMA_15740 ,
182- 0 , # No string descriptor
186+ i_interface ,
183187 )
184188
185189 # Add the endpoints (bulk OUT, bulk IN, interrupt IN)
@@ -196,7 +200,7 @@ def desc_cfg(self, desc, itf_num, ep_num, strs):
196200
197201 def num_eps (self ):
198202 """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)
200204
201205 def on_open (self ):
202206 """Called when the USB host configures the device."""
0 commit comments