@@ -137,6 +137,7 @@ def list_mbeds(
137
137
logger .debug ("Candidates for display %r" , candidates )
138
138
result = []
139
139
for device in candidates :
140
+ device ['device_type' ] = self ._detect_device_type (device )
140
141
if ((not device ['mount_point' ] or
141
142
not self .mount_point_ready (device ['mount_point' ])) and
142
143
not self .list_unmounted ):
@@ -146,7 +147,8 @@ def list_mbeds(
146
147
"Use the '-u' flag to include it in the list." ,
147
148
device ['target_id_usb_id' ])
148
149
else :
149
- platform_data = self .plat_db .get (device ['target_id_usb_id' ][0 :4 ], verbose_data = True )
150
+ platform_data = self .plat_db .get (device ['target_id_usb_id' ][0 :4 ],
151
+ device_type = device ['device_type' ] or 'daplink' , verbose_data = True )
150
152
device .update (platform_data or {"platform_name" : None })
151
153
maybe_device = {
152
154
FSInteraction .BeforeFilter : self ._fs_before_id_check ,
@@ -167,6 +169,9 @@ def list_mbeds(
167
169
self .retarget_data [device ['target_id' ]])
168
170
except KeyError :
169
171
pass
172
+
173
+ # This is done for API compatibility, would prefer for this to just be None
174
+ device ['device_type' ] = device ['device_type' ] if device ['device_type' ] else 'unknown'
170
175
result .append (maybe_device )
171
176
172
177
return result
@@ -211,13 +216,11 @@ def _update_device_from_fs(self, device, read_details_txt):
211
216
output dict attributes read from other files present on the 'mount_point'
212
217
"""
213
218
if not device .get ('mount_point' , None ):
214
- device ['device_type' ] = 'unknown'
215
219
return
216
220
217
221
try :
218
222
directory_entries = os .listdir (device ['mount_point' ])
219
223
device ['directory_entries' ] = directory_entries
220
- device ['device_type' ] = self ._detect_device_type (device )
221
224
device ['target_id' ] = device ['target_id_usb_id' ]
222
225
223
226
{
@@ -230,7 +233,6 @@ def _update_device_from_fs(self, device, read_details_txt):
230
233
'Marking device with mount point "%s" as unmounted due to the '
231
234
'following error: %s' , device ['mount_point' ], e )
232
235
device ['mount_point' ] = None
233
- device ['device_type' ] = 'unknown'
234
236
235
237
236
238
def _detect_device_type (self , device ):
0 commit comments