Add udev rules for picotool (#50)
Co-authored-by: Graham Sanderson <graham.sanderson@gmail.com>
diff --git a/README.md b/README.md
index 8f4b74b..fffa32c 100644
--- a/README.md
+++ b/README.md
@@ -4,15 +4,39 @@
You also need to install `libusb-1.0`.
-Linux/Mac: use your favorite package tool. For example, on Ubuntu:
+### Linux / macOS
+
+Use your favorite package tool to install dependencies. For example, on Ubuntu:
```console
sudo apt install build-essential pkg-config libusb-1.0-0-dev cmake
```
-Windows: download from here https://libusb.info/
+On Linux you can add udev rules in order to run picotool without sudo:
-If you are on Windows, set LIBUSB_ROOT environment variable to the install directory
+```console
+sudo cp udev/99-picotool.rules /etc/udev/rules.d/
+```
+
+### Windows
+
+##### For Windows without MinGW
+
+Download libUSB from here https://libusb.info/
+
+set LIBUSB_ROOT environment variable to the install directory.
+```console
+mkdir build
+cd build
+cmake -G "NMake Makefiles" ..
+nmake
+```
+
+##### For Windows with MinGW in WSL
+
+Download libUSB from here https://libusb.info/
+
+set LIBUSB_ROOT environment variable to the install directory.
```console
mkdir build
@@ -21,18 +45,9 @@
make
```
-for Windows non MinGW/WSL:
+##### For Windows with MinGW in MSYS2:
-```console
-mkdir build
-cd build
-cmake -G "NMake Makefiles" ..
-nmake
-```
-
-Windows with MinGW in MSYS2:
-
-No need to download libusb separately or set LIBUSB_ROOT.
+No need to download libusb separately or set `LIBUSB_ROOT`.
```console
pacman -S $MINGW_PACKAGE_PREFIX-{toolchain,cmake,libusb}
diff --git a/udev/99-picotool.rules b/udev/99-picotool.rules
new file mode 100644
index 0000000..10bd436
--- /dev/null
+++ b/udev/99-picotool.rules
@@ -0,0 +1,10 @@
+SUBSYSTEM=="usb", \
+ ATTRS{idVendor}=="2e8a", \
+ ATTRS{idProduct}=="0003", \
+ MODE="660", \
+ GROUP="plugdev"
+SUBSYSTEM=="usb", \
+ ATTRS{idVendor}=="2e8a", \
+ ATTRS{idProduct}=="000a", \
+ MODE="660", \
+ GROUP="plugdev"