If your drawing tablet works but only after you run a script as root, or the stylus buttons do nothing, a udev rule is the fix. This guide shows you how to create a rule that gives your user permission to access the tablet’s USB device automatically when you plug it in, so you can use it without sudo or manual chmod.
What You’ll Need
- A Linux system with udev (all mainstream distros have it).
- A drawing tablet connected via USB (wireless dongles usually appear as USB too).
- Terminal access with sudo privileges.
- Your username (find it with
whoami).
Step-by-Step
- Identify your tablet’s USB vendor and product IDs. Plug in the tablet, then run
lsusbin a terminal. Look for a line containing your tablet’s brand name. It looks like:Bus 001 Device 003: ID 256c:006d Huion Tablet. The four-digit number before the colon is the vendor ID (e.g.,256c), and the four-digit number after is the product ID (e.g.,006d). Write these down. If you don’t see your tablet, try a different USB port or checkdmesgfor clues. - Create a new udev rules file. Open a terminal and run:
sudo nano /etc/udev/rules.d/99-tablet.rules. You can name the file anything as long as it ends in.rules, but using99-ensures it’s read after most other rules. - Write the rule. In the file, add a line like this, replacing
1234and5678with your actual vendor and product IDs, andyourusernamewith your login name:SUBSYSTEM=="usb", ATTRS{idVendor}=="1234", ATTRS{idProduct}=="5678", MODE="0666", OWNER="yourusername"
This rule matches your specific tablet and sets the device file’s permissions to read/write for everyone (0666) and assigns ownership to your user. If you prefer, you can omitOWNERand just useMODE="0666"– that alone usually fixes permission issues. - Save and exit. In nano, press
Ctrl+Oto save, thenCtrl+Xto exit. - Reload udev rules. Run
sudo udevadm control --reload-rulesto make the system pick up the new rule without rebooting. - Trigger the rule for already-connected devices. Run
sudo udevadm triggerto apply the rule to devices that are already plugged in. If your tablet has multiple USB interfaces (e.g., for the stylus and for the pad buttons), you may need to unplug and replug the tablet for all interfaces to get the new permissions. - Test. Unplug and replug your tablet. Run
ls -l /dev/tablet*or check withlsusbagain. The device should now show your username as owner or havecrw-rw-rw-permissions. Try opening your drawing application – the stylus should work without any extra steps.
Common Mistakes
- Using the wrong IDs. Copying IDs from a forum post that doesn’t match your exact model. Always get them from your own
lsusboutput. - Forgetting to reload or trigger. Editing the file but not running
udevadm control --reload-rulesandudevadm triggermeans the change won’t take effect until you reboot. - Using
ATTRinstead ofATTRS. TheATTRSform searches all parent devices, which is necessary because the vendor/product IDs are often on the parent USB device, not the interface node. - Not matching the subsystem. If you omit
SUBSYSTEM=="usb", the rule might match unintended devices or not match at all. - Setting MODE to 0777. While it works, it’s overly permissive. 0666 is enough for a tablet.
Tips
- If you have multiple tablets or want a rule that works for all devices from the same vendor, you can omit the
ATTRS{idProduct}part and match only on the vendor ID. This is less precise but convenient. - Use
udevadm info -a -n /dev/tablet(replace/dev/tabletwith the actual device node) to see all attributes you can match on, such asATTRS{manufacturer}orATTRS{product}. - If you’re using a distro with systemd, you can also use
sudo udevadm test /sys/class/input/eventX(replace eventX with your tablet’s event number) to see which rules would apply. - Keep a backup of your original rules file before editing.
Troubleshooting
- Rule doesn’t seem to apply. Run
sudo udevadm test /sys/class/input/eventX(use the event number fromls /dev/inputordmesg). This shows which rules match and what permissions are set. If your rule isn’t listed, check the file name and syntax. - Tablet still not working in the app. The udev rule only fixes permission issues. If the tablet was already recognized but buttons don’t work, the problem might be in the app’s configuration or a missing driver. Check if the tablet appears in
libinput list-devicesorxsetwacom --list devices(for Wacom). - Permission denied even after rule. Make sure the rule file has no syntax errors – a missing comma or extra space can break it. Also, some tablets expose multiple device nodes (e.g.,
/dev/input/event*and/dev/usb/hiddev*); your rule may need to match the correct subsystem. Try addingSUBSYSTEM=="hidraw"as well. - Changes only work after reboot. That’s normal if you skipped the
udevadm triggerstep. Run it again. - Tablet works, but only as root. Your rule might be matching but the app is looking at a different device file. Use
ls -l /dev/input/event*and check which one your tablet uses, then verify the rule applies to that path.
Frequently Asked Questions
Do I need a udev rule if my tablet works out of the box?
No. If the tablet works without any extra steps, you don’t need a rule. This guide is for when you get permission errors or need to run a script as root.
What if my tablet uses a wireless dongle?
Most wireless dongles still appear as USB devices, so the same steps apply. Use lsusb with the dongle plugged in to find the IDs.
Can I use this rule for a mouse or other USB device?
Yes, the same rule structure works for any USB device. Just change the vendor/product IDs and possibly the subsystem (e.g., input for mice).
Is it safe to use MODE=”0666″?
Yes, for a drawing tablet it’s safe. It allows any user on the system to read/write to the device, but that’s typically fine for a peripheral that only you use. If you’re on a shared system, consider using OWNER and GROUP instead.
Why does my tablet still not work after adding the rule?
Check if the tablet needs a proprietary driver (like some Huion or XP-Pen models). The udev rule only handles permissions; the driver must be installed separately.
How do I remove the rule?
Delete the .rules file you created and run sudo udevadm control --reload-rules. The tablet will go back to its previous behavior.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Hogwarts Legacy Microsoft Visual C Runtime Error Fix
- Set Up UPI Payments Through WhatsApp
- Pair Oppo Enco Earbuds with Android, iPhone & Windows
- Fix Administrator Account Disabled Error in Windows 11
- How to Play Kodi on Smart TV from PC
- How to Change Password in Linux (Command Line)