File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -191,13 +191,14 @@ def main():
191191
192192
193193 if os .name == 'posix' :
194- mount_output = check_output ('mount' ).splitlines ()
195- mounted_volumes = [x .split ()[2 ] for x in mount_output ]
196194 flashed = 0
197- for volume in mounted_volumes :
198- if re .match (b'.*MICROBIT[0-9]*$' , volume ):
199- print ('[i] Flashing %s ...' % volume .decode ('ascii' ))
200- path = os .path .join (volume .decode ('ascii' ),'fw.hex' )
195+ for line in check_output ('mount' ).splitlines ():
196+ line = line .decode ('ascii' )
197+ match = re .match (r'^\S+ on (.*MICROBIT(\s?[0-9]+)?)' , line )
198+ if match :
199+ volume = match .group (1 )
200+ print ('[i] Flashing %s ...' % volume )
201+ path = os .path .join (volume ,'fw.hex' )
201202 fw = open (fw_path ,'r' ).read ()
202203 # copy our firmware on it
203204 with open (path , 'wb' ) as output :
You can’t perform that action at this time.
0 commit comments