.. | ||
build_static.sh | ||
Makefile | ||
readme.md | ||
setupapi.c | ||
setupapi.dll | ||
setupapi.spec |
Simple low level winelib usb wrapper for the Minipro TL866A/CS, TL866II+, Xgecu T48, T56 and T76 programmers.
Installing the udev rules:
Add the following rules to the udev subsystem:
sudo cp ./udev/* /etc/udev/rules.d/ && sudo udevadm control --reload-rules && sudo udevadm trigger
This will grant you permission to run the software as regular user, otherwise you must be a superuser.
How to install:
- Install
wine
,libusb
andlibudev
packages
You should install the 32 bit version ofLibUsb
andlibudev
and create a 32 bit wine prefix:
sudo apt install libusb-1.0-0:i386 libudev1:i386
WINEPREFIX="$HOME/wine32" WINEARCH=win32 wine wineboot
-
Copy the provided setupapi.dll file in the Minipro or Xgpro folder
-
Run the
Minipro.exe
,Xgpro.exe
orXgpro_T76.exe
usingwine
:
WINEPREFIX="$HOME/wine32" wine ./Xgpro.exe 2>/dev/null
If you already have a default 32 bit wine
prefix located in $HOME/.wine
you can use it without creating a new one:
wine ./Xgpro.exe 2>/dev/null
How to compile:
-
Install
wine
,wine-devel
,libusb-1.0-0-dev:i386
,libudev-dev:i386
packages -
Run
make
to compile thesetupapi.dll
usinglibusb
library for hotplug events. You can also uselibudev
to compile thesetupapi.dll
usinglibudev
library for handling hotplug events which can
be useful iflibusb
hotplug events arenot available in your OS by runningmake hotplug=udev
-
Copy the resulted
setupapi.dll
file in the Minipro/Xgpro folder
Debugging:
Running this in a terminal session:
TL_DEBUG=1 wine ./Xgpro.exe or TL_DEBUG=1 wine ./Xgpro.exe 2>/dev/null
will dump all usb communication to the console which can be very useful when something goes wrong.
The 2>/dev/null
will redirect the stderr
to /dev/null
thus cancelling the wine debugging messages which can be
very annoying sometime.
You can also use gdb
GNU debugger for debugging:
WINEDEBUG=fixme-all,-ALL WINELOADERNOEXEC=1 gdb -q --args wine ./Xgpro.exe
(gdb) run
Issues on some Linux distros
Some Linux distros will compile its system libraries with SSE instruction set enabled to increase the performance.
This is a good thing but, using a Libusb
compiled with SSE will crash our wine wrapper library because the SSE intruction
set requires the memory address to be 16-byte aligned and, our setupapi.dll
uses 4 bytes stack alignment because
the 32bit Windows software is also using this 4 byte alignment. See issue #51.
This is the case for Arch/ManjaroGentoo and its derivatives and perhaps other distros i have not tested yet.
In this case we must compile our Libusb and use it to link the setupapi.dll
against it.
This is for Arch/Manjaro users, Gentoo users please adapt the needed packages as i don't test it in Gentoo.
First install the necessary tools:
sudo pacman -S autoconf automake libtool git base-devel lib32-libusb
Then grab these git repos:
mkdir build_temp && cd build_temp
git clone https://github.com/radiomanV/TL866.git && cd TL866/wine
git clone https://github.com/libusb/libusb.git && cd libusb
Now configure and build the static 32bit libUsb
:
./bootstrap.sh && ./configure CFLAGS="-m32 -mstackrealign -fPIC" --prefix="$(dirname "$(pwd)")" --disable-shared && make install && cd ../
And finally (assuming the wine is installed) compile our setupapi.dll
against the static LibUsb
:
make CFLAGS="-Iinclude/ -m32 -mstackrealign" LIBS="-Wl,--whole-archive lib/libusb-1.0.a -Wl,--no-whole-archive -ludev"
You can automate this by using the accompanying build_static.sh
script
which will invoke all above commands and build the statically linked setupapi.dll
./build_static.sh
If all was okay we should have the setupapi.dll
in the current directory.
You can always download the already compiled setupapi.dll from this git repository, but sometimes depending on your Linux distro
and glib
version it will not work and you must recompile it.