How-to use USBlini with Python on Raspberry Pi

This step-by-step tutorial shows how to use USBlini with Python on fresh installed Raspberry Pi OS Lite 11 (bullseye).

1. Install library

sudo apt-get update
sudo apt-get install python3-pip git
pip install git+https://github.com/EmbedME/pyUSBlini

2. Add udev rule

Add udev rule to give permissions to all users.
sudo bash -c $'echo \'SUBSYSTEM=="usb", ATTRS{product}=="USBlini", MODE="0666"\' > /etc/udev/rules.d/50-USBlini.rules'
sudo udevadm control --reload-rules

3. Test connection to USBlini

Start Python interpreter.
python
Check if a connection to the USBlini can be established with following Python code:
from usblini import USBlini
usblini = USBlini()
usblini.open()
usblini.close()

4. Run python script

Now USBlini can be used with Python, e.g. with the detection tool:
wget https://raw.githubusercontent.com/EmbedME/pyUSBlini/main/tools/detect.py
python detect.py