View previous topic :: View next topic |
Author |
Message |
ebray187 Tux's lil' helper
Joined: 02 Mar 2005 Posts: 121 Location: Al otro lado de la pantalla
|
Posted: Thu Feb 11, 2021 12:57 am Post subject: [How to] Gaomon/Generic drawing tablets |
|
|
I want to share this little tutorial for future reference and to help those who have had troubles setting up these cheap but otherwise excellent drawing tablets. A Gaomon s620 bought on aliexpress in my case.
TOC:- Installing the drivers
- Config the tablet
- The setup script
- Autorunning the script with udev
1. Installing the drivers
Unfortunately we will have to install the drivers outside portage because we don't have a DIGImend package yet (02/10/2021).
First, unplug the tablet, and download the driver (v10): https://github.com/DIGImend/digimend-kernel-drivers/releases
Unzip and then compile: Code: | digimend-kernel-drivers-10 $ make
digimend-kernel-drivers-10 # make install | If everything went ok, for simplicity just reboot.
Note: When upgrading the kernel we will have to manually reconfigure the drivers: $ make clean then compile and install again.
Now the driver should be operational, so connect the tablet and the system should recognize it. In my case KDE show a corresponding notification (with kde-misc/wacomtablet package installed).
Also xsetwacom should be able to list the device: Code: | $ xsetwacom list
GAOMON Gaomon Tablet stylus id: 18 type: STYLUS
GAOMON Gaomon Tablet Touch Strip pad id: 21 type: PAD
GAOMON Gaomon Tablet Pad pad id: 22 type: PAD |
2. Config the tablet
In KDE the area can be config inside System Preferences → Input Devices → Graphic Tablet
Otherwise you could set it through these commands:
First get the <NAME> with: $ xsetwacom list, then to get the max area values: Code: | $ xsetwacom get "GAOMON Gaomon Tablet stylus" Area
0 0 33020 20320 |
The command to setup the area is this: Code: | $ xsetwacom set <NAME> Area <L> <T> <R> <B> |
<L> and <T> are the coordinates of the first point (left-top corner, 0 0 min values) and <R> <B> are the coordinates of the second point of the drawing area (right-bottom corner, max values are 33020 20320 in this case).
So with a little math you can define the coordinates so that they are proportional to the 1920x1080 16:9 screen and the area is centered on the vertical axis of the tablet. For the hurried and/or the lazy: Code: | $ xsetwacom set "GAOMON Gaomon Tablet stylus" Area 0 873 33020 19447 |
For the buttons i couldn't set the meta key for my shorcuts with KDE, but no problem it can be done manually directly with xsetwacom:
Code: | $ xsetwacom set "GAOMON Gaomon Tablet Pad pad" button 3 key Super Ctrl 2 |
Notes:
- The button numbers are generally as follow: 1, 2, 3, 8, 9, 10, 11, etc...
- For more info $ man xsetwacom
3. The Setup Script
At this point making our own script that configures the buttons (and the area) should be a simple process: $ nano gaomon_s620.sh
Code: | #!/bin/bash
#Drawing Area
#xsetwacom set "GAOMON Gaomon Tablet stylus" Area 0 873 33020 19447
#Express Buttons
xsetwacom set "GAOMON Gaomon Tablet Pad pad" button 1 key Ctrl z
xsetwacom set "GAOMON Gaomon Tablet Pad pad" button 2 key 2
xsetwacom set "GAOMON Gaomon Tablet Pad pad" button 3 key Super Ctrl 2
xsetwacom set "GAOMON Gaomon Tablet Pad pad" button 8 key Super Ctrl 1 |
Remember to give execution permissions to the file $ chmod +x gaomon_s620.sh
4. Autorunning the script with udev
For the script to work automatically when connecting the tablet, we could add a udev rule. This process can be a little tricky so here are my conclutions.
The first thing we need is get some device info. Unplugg the device and run: Code: | # udevadm monitor --environment --udev |
Then connect the tablet (ctrl + c to end the monitor). It should show a lot of information about the device:
Code: | monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
UDEV [8742.051108] add /devices/pci0000:00/0000:00:1a.2/usb5/5-2 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1a.2/usb5/5-2
SUBSYSTEM=usb
DEVNAME=/dev/bus/usb/005/005
DEVTYPE=usb_device
PRODUCT=256c/6d/100
TYPE=0/0/0
BUSNUM=005
DEVNUM=005
SEQNUM=3566
USEC_INITIALIZED=8742041029
ID_VENDOR=GAOMON
ID_VENDOR_ENC=GAOMON
ID_VENDOR_ID=256c
ID_MODEL=Gaomon_Tablet
ID_MODEL_ENC=Gaomon\x20Tablet
ID_MODEL_ID=006d
ID_REVISION=0100
ID_SERIAL=GAOMON_Gaomon_Tablet
ID_BUS=usb
ID_USB_INTERFACES=:030102:
ID_PATH=pci-0000:00:1a.2-usb-0:2
ID_PATH_TAG=pci-0000_00_1a_2-usb-0_2
ID_FOR_SEAT=usb-pci-0000_00_1a_2-usb-0_2
DRIVER=usb
MAJOR=189
MINOR=516
... |
Take note of the values in ACTION, SUBSYSTEM, ID_VENDOR_ID and ID_MODEL_ID. With this we can make the udev rule that executes our script: # nano /etc/udev/rules.d/90-local.rules
Code: | ACTION=="add", SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="256c", ENV{ID_MODEL_ID}=="006d", RUN+="/usr/local/bin/tablet_setup.sh" |
This should run, every time the tablet is connected, the script tablet_setup.sh inside /usr/local/bin/
But with udev things are not as simple at its seem. The script must run after the system configures the tablet, so we are goint to use tablet_setup.sh as a wrapper script that launch our config script in the background: # nano /usr/local/bin/tablet_setup.sh Code: | #!/bin/bash
/usr/local/bin/gaomon_s620.sh & |
Also we need to modify the script to avoid permission, changing id and display problems:# nano /usr/local/bin/gaomon_s620.sh Code: | #!/bin/bash
sleep 1
export XAUTHORITY=/home/username/.Xauthority
export DISPLAY=:0
#xsetwacom commands here:
/usr/bin/xsetwacom set "GAOMON Gaomon Tablet Pad pad" button 1 key Ctrl z
/usr/bin/xsetwacom set "GAOMON Gaomon Tablet Pad pad" button 2 key 2
/usr/bin/xsetwacom set "GAOMON Gaomon Tablet Pad pad" button 3 key Super Ctrl 2
/usr/bin/xsetwacom set "GAOMON Gaomon Tablet Pad pad" button 8 key Super Ctrl 1 |
Now finally after a reboot everything must be ok.
Great!
References:
https://github.com/DIGImend/digimend-kernel-drivers
https://wiki.gentoo.org/wiki/Udev
https://wiki.archlinux.org/index.php/Udev
https://osu.ppy.sh/community/forums/topics/1122479
https://unix.stackexchange.com/questions/65788/why-doesnt-xsetwacom-work-from-udev _________________ # emerge -C world >> 9/8
A flower?!
Last edited by ebray187 on Wed Jul 27, 2022 5:26 pm; edited 8 times in total |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 31333 Location: here
|
Posted: Thu Feb 11, 2021 6:48 am Post subject: |
|
|
Moved from Kernel & Hardware to Documentation, Tips & Tricks. _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|