Setup Huion Giano WH1409 tablet on Linux Mint 18.1 or Ubuntu 16.04

Published on

Disclaimer: I'm not sponsored by Huion for this article and I purchased this tablet myself, it's not a commercial gift. Also, this article was designed for Linux Mint 18 and Ubuntu 16.04: it will not work with the same command line for later versions. If you want to know what changed, read the comments of this article, I'll update the article later.


2020-11 Update: it works on Kubuntu 20.04. I took it from my closet for a sunday evening test and was surprised how simplier is it to get it work two years after this article. It just require to install the Digimend driver (deb) version 10, reboot, and then all works if you connect it via the wireless USB dongle (the cable connection will only charge the battery of the tablet and doesn't work).

Also, good to notice: the KDE system setting panel for tablets works fine except (calibration/setting monitor area/proportion/stylus buttons) but no tablet buttons are listed, it probably require a bit more tweaking. Anyway easy install! I'll put it back to the closet because I'm still not fan of the pressure curve of the stylus and I'll keep using my other Wacom tablet.

Here is a photo:


Intro

After the buglary of my house, I had to purchase a new tablet. I have a long experience with tablets, I owned so many models over the last 15 years that I even maintain for the fun a tablet history log about it. For once and after 15 years of Wacom, I also studied another brand: Huion. I liked the design of the WH1409 (no big padding around active area), the spec (maybe the largest active zone on a tablet right now on the market, 35x22cm / 13,8x8,6inch) and the low price (160€, the third of the price of a similar model made by Wacom). The problem: the driver. No official GNU/Linux driver or tweak for this model, and a almost dead Digimend project: the leader decided to leave the project for good reasons after a decade of hard work on it, but now the project is orphan and is looking for a new maintainer... So it's not a good sign of health for all the non Wacom, but I decided to take the risk of getting something non-functional and tweak-it as a hobby until I get it working. Now it's done and I'm sharing the result to ease the path to other GNU/Linux artists around wanting a low-cost large tablet. :-) Not everything work perfectly, I'll end the article with a review of pros/cons and limitations of this model under a free/libre O.S.

Status after unboxing

On a Linux Mint Cinnamon 18.1, it was a surprise when I first connected the tablet: the coordinate, pressure, all main feature worked out-of-the-box (USB cable only, not wireless). But no button, no way to map the tablet to a single screen of my dual screen. And even when turning a screen off with xrandr, bad raw proportion for the classic 1920x1080.
The kernel 4.4.0-79-generic I'm using has the module of the Digimend project included, and the tablet is probably compatible with a part of the driver: if you type lsusb in a terminal, the tablet <CONSTRUCTOR>:<MODEL> is 256c:006e , and 256c in the Digimend project source-code probably triggers a default/generic Huion driver. So, even if the model is unlisted on the official documentation, the basics work. That was encouraging.
After unboxing

Install Digimend driver via DKMS:

I wanted to be sure to get the latest source code compiled for the Digimend project, in case more could work with more recent development. Unfortunately, I had to make many test and trial to compile the source of the project. Impossible to do the make/make install, 'deb' package not working... I had to search a long time how I could do. After many research, it appear all Ubuntu-based 16.04 can't compile custom module this way. It's prohibited (but the error message wasn't very obvious about it). The only option is to install the DKMS way. The README.md file of the project doesn't explain how. After research, I learned the joy of DKMS. To install via DKMS, you'll need Git, and DKMS.

sudo apt install dkms git-core 

then we will put the source code inside a specific directory with the structure /usr/src/<PROJECTNAME>-<VERSION> , then build it using this time <PROJECTNAME>/<VERSION> :

sudo git clone https://github.com/DIGImend/digimend-kernel-drivers.git /usr/src/digimend-6  
sudo dkms build digimend/6  
sudo dkms install digimend/6

Reboot your computer. The tablet should now start to work better, smoother and being listed as "TABLET Pen Tablet Pen stylus" when entering this command in a terminal:

xinput --list

The digimend driver should be listed among other modules after typing:

dkms status

Icing on the cake, you can now remove the USB cable (used to charge the tablet), connect the wireless USB dongle, and use the tablet in wireless. The tablet is still here with lsusb.

Add a custom X11 rules:

We need a way to now configure the tablet, the buttons. We will add a X11 custom rule to make the Digimend driver use the Wacom driver command line tool to setup our non-named <TABLET>. Call your text-editor in admin mode:

sudo xed /usr/share/X11/xorg.conf.d/50-huion.conf

Then paste this inside, save and close.

# Huion tablets  
Section "InputClass"  
    Identifier "Huion class"  
    MatchProduct "TABLET"  
    MatchIsTablet "on"  
    MatchDevicePath "/dev/input/event*"  
    Driver "wacom"  
EndSection  

Section "InputClass"  
    Identifier "Huion buttons"  
    MatchProduct "TABLET"  
    MatchIsKeyboard "on"  
    MatchDevicePath "/dev/input/event*"  
    Driver "evdev"  
EndSection  

Section "InputClass"  
    Identifier "Huion scroll"  
    MatchProduct "TABLET"  
    MatchIsPointer "off"  
    MatchIsKeyboard "off"  
    MatchIsTouchpad "off"  
    MatchIsTablet "off"  
    MatchIsTouchscreen "off"  
    MatchDevicePath "/dev/input/event*"  
    Driver "evdev"  
EndSection

Reboot your computer. After that, the tablet should appear in the configuration tool xsetwacom:

xsetwacom --list

Congratulation! You're done with the driver part.

User preference, buttons, settings.

Now, let configure the tablet with xsetwacom.
For this, we can load xsetwacom command. But they are not persistent avec restarting computer.
So we need to store this collections of commands in a bash script and call this bash script when the system open.

mkdir scripts  
xed ~/scripts/Huion_WH1409.sh

... and inside paste and customize the script under. To know the list of special "key" you can map on buttons, look at this list. Don't forget to change the screen size to your screen size (the tablet is not 100% same ratio than 1920x1080, it needs code to force good vertical and horizontal ratio so when you trace a circle on your tablet, a circle appear on the screen, and not an ellipse potato ). And comment or delete all the line you are not interested.

#! /bin/bash  
# Setup HUION WH1409, after bridged to wacom driver with Digimend Kernel module.  
# License: CC-0/Public-Domain license  
# author: deevad  

# Tablet definition  
tabletstylus="TABLET Pen Tablet Pen stylus"  
tabletpad="TABLET Pen Tablet Pad pad"  

# Reset  
xsetwacom --set "$tabletstylus" ResetArea  
xsetwacom --set "$tabletstylus" RawSample 4  

# Mapping  
# get maximum size geometry with:  
# xsetwacom --get "$tabletstylus" Area  
# 0 0 55200 34500  
tabletX=55200  
tabletY=34500  
# screen size:  
screenX=1920  
screenY=1080  
# map to good screen (dual nvidia)  
xsetwacom --set "$tabletstylus" MapToOutput "HEAD-0"  
# setup ratio :  
newtabletY=$(( $screenY * $tabletX / $screenX ))  
xsetwacom --set "$tabletstylus" Area 0 0 "$tabletX" "$newtabletY"  


# Buttons  
# =======  
xsetwacom --set "$tabletstylus" Button 2 2   
xsetwacom --set "$tabletstylus" Button 3 3  
# ---------  
# | 1 | 2 |  
# |---|---|  
# | 3 | 8 |  
# |=======|  
# | 9 |10 |  
# |---|---|  
# |11 |12 |  
# |=======|  
# |13 | ? |  
# |---|---|  
# | ? | ? |  
# |=======|  
xsetwacom --set "$tabletpad" Button 1 "key Control_L" # color picker on ring  
xsetwacom --set "$tabletpad" Button 2 "key Shift_L" # resize brush  
xsetwacom --set "$tabletpad" Button 3 "key KP_Divide" # switch /  
xsetwacom --set "$tabletpad" Button 8 "key e" # eraser  
xsetwacom --set "$tabletpad" Button 9 "key z"  # undo  
xsetwacom --set "$tabletpad" Button 10 "key y"  
xsetwacom --set "$tabletpad" Button 11 "key tab"  
xsetwacom --set "$tabletpad" Button 12 "key r"  
xsetwacom --set "$tabletpad" Button 13 "key m"  


# Xinput option  
# =============  
# for the list:  
# xinput --list  

# xinput list-props 'TABLET Pen Tablet Mouse'  
xinput set-prop 'TABLET Pen Tablet Mouse' "Evdev Middle Button Emulation" 0  
# alternate way to map to a single screen  
# execute "xrander" in a terminal to get the screen name ( DVI-D-0 in this example )  
# xinput set-prop 'TABLET Pen Tablet Pen stylus' DVI-D-0


The various IDs of buttons I identified.
... and the three non-working.
When your script is finished you can save it. Then give it execute permission: In the file-manager ; right-click on it again > Properties > Permissions > and in front of Execute check the box for 'Allow executing file as a program'. You can now double click and run the script. Test and adjust to your needs. Your key on tablet will be mapped for the active session. To keep the settings accross reboot, you'll have to auto execute the script at start-up. To do this, go to 'System Settings', then 'Start-up application'. A user interface will propose you to add your script as a start-up script. You can also create a Menu entries if you need to run multi-scripts (right click on the menu button > Configure > Menu (Tab) > Open the menu editor to create a custom menu entry).
Interface in Linux Mint to add the Huion script

Review of the tablet

What doesn't work:
- The three last buttons of the tablets. But with 9 working and fully functional, I'm not complaining.
- Assigning special button on the stylus: I'm used to put Ctrl to color pick on the first button, but I can't: it trigger a middle-click+left-click interpreted as a right-click. Color picking on Krita shows the pop-up-Palette...
- Small glitch when switching tablet to mouse, and mouse to tablet. The system sometime has difficulty to 'leave' the table mode, and let the mouse work. What's is 'meh' with this tablet:
- No GNU/Linux official support.
- Near to dead Digimend project.
- This smooth plastic "peach skin" coating on the stylus; they often turn sticky as hell after 3 or 4 years.
- The nibs of the stylus are floating a little bit inside the tube of the stylus tip.
- No eraser at the back of the stylus. (I'm not using it often anyway)
- No tilt/rotation sensor ( i'm not using them too ) What's surprisingly works better than I expected:
- The stylus need a battery, but this one doesn't impact the weight. The stylus is as heavy as a Wacom battery-less one.
- The buttons on the pad, I expected them to be cheap things with horrible keypress sound and too-hard or too-sensitive. They are in fact better than on all model of Wacom; easy to press almost like on a flat keyboard.
- Wireless. I never thought when I started this adventure this feature would work. My previous tablet , the Cintiq 13HD had a so massive wire and dumb connector the marketing of Wacom removed it on all the picture of the product ( even showing the tablet running with the screen 'on' without any power supply... marketing lie). Wireless for a tablet is a new comfort.
- Pressure sensitivity: the stylus is a bit more firm than my previous Cintiq13HD, it has more control over the pressure because you need to press physically more on the stylus to reach 100% of pressure, that's an advantage if you like glazing with low opacity , or need dancy line with many variation of line width. What's cool:
- Size of the active area: with 35x22cm / 13,8x8,6inch ; I'm more near to a 1:1 ratio between my tablet and my 21'' 1080p screen. I can draw small details, small circles, little high-light without having a dancy cursor on screen.
- coating of the active area: smooth as Intuos3, my favorite coating (note: it might feel too-smooth for artist liking a little grain)
- Design: no big padding around the active zone, wireless and black. Looks good on a desk. Large enough to put the keyboard on it when not drawing and typing.
- Price for a large tablet. In the last 15 year, this is the first time I see this. It should open large tablet to a non professional audience.
- No "touch" option or necessity to add a switch to turn it on/off. I like tablet without "touch"
- Stylus diameter, tubular design, not pear-like ergonomic design as Wacom do.

End note:

It's in overall a good tablet but hard to advice it to a beginner on GNU/Linux. Really. It looks like running this hardware will be harder and harder with time. On my side, I'll keep this tablet in production for the next webcomic to give it more hours. Let see if this thing can handle more than three episode of Pepper&Carrot. If you already have feedback about it, questions, tweaks, advices, feel free to share them here.

Sources:

https://digimend.github.io/
http://linuxwacom.sourceforge.net/wiki/index.php/Xsetwacom
https://wiki.archlinux.org/index.php/Dynamic_Kernel_Module_Support
https://www.reddit.com/r/krita/comments/3w6ohb/krita_huion_h610_tablet_on_dual_displays_issue/cxu5qqt/
http://quandtum.weebly.com/home/how-to-change-mouse-button-functions-in-linux