ntoll / uflash

A module and command to easily flash Python onto the BBC's micro:bit device.
http://micropython.org/
MIT License
101 stars 27 forks source link

uflash fails to find microbit #59

Open rhubarbdog opened 5 years ago

rhubarbdog commented 5 years ago

I was trying some blocks and returned to micropython. when i tried command uflash my-script.py i get error message Error flashing pongo.py to microbit: Unable to find micro:bit. Is it plugged in?

solution uflash my-script.py ~/Downloads that creates a micropython.hex in ~/Downloads I just copied that using a GUI file manager to my microbit

but with this script now flashed to the micobit uflash my-script.py still fails

spalbird commented 4 years ago

Our company IT does not allow booting from removeable drive. Maybe a security mechanism alters a return value? Not sure...

I located following problem in uflash.py in find_microbit() function: "if ctypes.windll.kernel32.GetDriveTypeW(path) != 2:" will fail because this function returns 1 on my Window10 company PC

from https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdrivetypew

1 DRIVE_NO_ROOT_DIR (The root path is invalid; for example, there is no volume mounted at the specified path.) 2 DRIVE_REMOVABLE (The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.)

I changed the line to "if not ctypes.windll.kernel32.GetDriveTypeW(path) in (1, 2):"

Download uflash-1.3.0.tar.gz from https://pypi.org/project/uflash/#files Modify line as described above reinstall with "python setup.py install"

If it still doesn't work for you debug uflash.py yourself.