- Install required python packages using pip:
- pyusb
- libusb
- mss
- Add the udev rule
50-usb-tinymonitor.rules
file inside/etc/udev/rules.d/
folder. - Add current user to
plugdev
using:adduser <username> plugdev
- Reload and restart udev using:
sudo udevadm control --reload
sudo udevadm trigger
sudo service udev reload
sudo service udev restart
- Connect the device using USB. The display should show "USB connected. Config is set..."
- Run the host software. You can modify the display capture area inside the python code.
- Install required python packages using pip:
- pyusb
- libusb
- mss
- Download
zadig
from https://zadig.akeo.ie/ - Plugin the device and run
zadig
. - Select the device named "display" from the first dropdown. Make sure the USB ID shows:
CAFE
CEAF
- Select "libusb-win32" driver from the right drop down. Then click "Install Driver" button.
- It should take some time. After installation done, the display should show "USB connected. Config is set..."
- Run the host software.
These are the python scripts to run on host (PC) for sending the screen data to device (STM32 Tiny Monitor). There are two folders
- Slow Host
- Fast Host
Slow host contains the original python script that I've written to establsih the data stream between host and device. This one works fine, but it's slow. Python's slowness in capturing screen and processing the captured data is causing the bottleneck.
To start host,
python host.py
To solve the aboce issue, the best way is to write the host software in C, which I'll do eventually. But for now, I gave "cython" a try, and it surely increased the performance noticeably. This is completely based on the Slow Host's python script but with some minor change to cythonize it. Then compiled to a .c file using setup.py. The main script is renamed from host.py
to fast_host.pyx
.
To compile,
python setup.py build_ext --inplace
To run, either
python start_host.py
or
python
>>> import fast_host
No need to run the Slow Host. This is kept here just for reference. Use Fast Host for best performance (higher fps).
I'll soon write a C/C++ host software to get even better speed (hopefully).