{ md380tools } » python -V /cygdrive/c/tools/md380tools
Python 2.7.8
{ md380tools } » cd c:/tools/pyusb /cygdrive/c/tools/md380tools
{ pyusb } » python setup.py install /cygdrive/c/tools/pyusb
........... (dozens of lines omitted here) ........
byte-compiling /usr/lib/python2.7/site-packages/usb/__init__.py to __init__.pyc
running install_egg_info
Writing /usr/lib/python2.7/site-packages/pyusb-1.0.0-py2.7.egg-info
{ pyusb } » /cygdrive/c/tools/pyusb
{ md380tools } » make flashdb /cygdrive/c/tools/md380tools
"make" -C db stripped.csv
make[1]: Entering directory '/cygdrive/c/tools/md380tools/db'
make[1]: 'stripped.csv' is up to date.
make[1]: Leaving directory '/cygdrive/c/tools/md380tools/db'
wc -c < db/stripped.csv > user.bin
cat db/stripped.csv >> user.bin
./md380-tool spiflashwrite user.bin 0x100000
No backend available
Makefile:93: recipe for target 'flashdb' failed
make: *** [flashdb] Error 1
{ md380tools } » /cygdrive/c/tools/md380tools 2
After following several threads about 'PyUSB / no backend available' at stackoverflow.com:
The problem is that i didn't include libusb0.dll and libusb-1.0.dll files
in PATH environment variable location
(...)
PyUSB module will check for libusb0.dll and libusb-1.0.dll files (which act as backends)
in the PATH environment variable and in C:\windows\System32 locations
and then establishes communication with USB devices.
Since i'm using libusb-win32-wizard for creating device drivers it uses libusb0.dll.
The process of execution can be found using following DEBUG program:
import os
os.environ['PYUSB_DEBUG'] = 'debug'
import usb.core
print list(usb.core.find(find_all=True))
C:\Windows\System32\libusb0.dll (76384 bytes, last modified 2013-09-29)
C:\Windows\SysWOW64\libusb0.dll (67680 bytes, last modified 2013-09-29)
Contained in the archive with "libusb_win32" (libusb-win32-bin-1.2.6.0.zip) were:
C:\tools\libusb-win32\bin\amd64\libusb0.dll (76384 bytes, last modified 2012-01-17 !)
C:\tools\libusb-win32\bin\x86\libusb0_x86.dll (67680 bytes, last modified 2012-01-17 !)
C:\tools\libusb-win32\bin\ia64\libusb0.dll (forget about this one, it's only for 'Itanium' CPUs)
After brainlessly copying those DLLs around, I still couldn't fix the No backend available
problem when trying to run the Python scripts that access USB in Babun, e.g.
spiflashwrite user.bin 0x100000
and any similar command resulted in No backend available.
But since "spiflashwrite" is entirely implemented in md380_tool.py, it should run
in any implementation of Python 2.7. So, after "the Python in Babun" failed to load
the libusbwinsomething-DLL, why not try "another Python" ? I tried the shell that came along
with MinGW32 (installed into C:/MinGW, not a crappy "Program Files (x86)" or similar folder ),
then installed PyUSB also for "that other Python", and ... bingo, see next chapter. Farewell Babun, hope to see you later, maybe.
Wolf@YHF6 /c/tools/md380tools
$ cd c:/tools/pyusb
Wolf@YHF6 /c/tools/pyusb
$ python setup.py install
Wolf@YHF6 /c/tools/pyusb
$ cd c:/tools/md380tools
Wolf@YHF6 /c/tools/md380tools
$ python md380_tool.py spiflashwrite user.bin 0x100000
SPI Flash ID: 10 dc 1 <- this indicates a problem !
W25Q128FV 16MByte maybe
erase 2586259 bytes @ 0x100000
flashing 2586259 bytes @ 0x100000
reboot radio now
Wolf@YHF6 /c/tools/md380tools
Execute the "testlibusb-win.exe" file, then click on the Refresh button
at the bottom of the popup window.
(Note this file is located in the libusb-win32-bin-1.2.6.0\bin\x86 folder).
Once you click on the Refresh button you will find that if you again issue a
./md380-tool spiflashid command (..), you will receive the proper response
from the radio:
SPI Flash ID: EF 40 18
W25Q128FV 16MByte
Wolf@YHF6 /c/tools/md380tools
$ python md380_tool.py spiflashid
No backend available # Aaaargh.. the old annoyance is back ! Continue here .
Wolf@YHF6 /c/tools/md380tools
$ python md380_tool.py spiflashid
SPI Flash ID: ef 40 18 <- hip-hip-hooray .. finally a correct Flash-chip-ID .. Thanks Ed !
W25Q128FV 16MByte
Wolf@YHF6 /c/tools/md380tools
$ python md380_tool.py spiflashwrite user.bin 0x100000
SPI Flash ID: ef 40 18
W25Q128FV 16MByte
erase 2586259 bytes @ 0x100000
flashing 2586259 bytes @ 0x100000
reboot radio now
Wolf@YHF6 /c/tools/md380tools
$