2014년 1월 8일 수요일

Getting Huion H610 drawing tablet working in Linux Kernel 3.12...

There is a huion driver, hid-huion, that has been in mainline since 3.11 but it only supports up to the Huion 580 8" x 5" drawing tablet. Fortunately, developer Nikolai Kondrashov has made an out-of-tree kernel driver that supports the Huion H610 10" x 6" drawing tablet.

To install the driver, you must first install linux kernel headers for your distro. In the case of Archlinux, sudo pacman -S linux-headers.

Next git clone Nikolai's huion-driver repo from github to a local folder:

[archjun@archbang AUR]$ git clone https://github.com/DIGImend/huion-driver.git
Cloning into 'huion-driver'...
remote: Reusing existing pack: 83, done.
remote: Total 83 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (83/83), done.
Checking connectivity... done.

cd into the directory huion-driver and then run make:

[archjun@archbang huion-driver]$ make
make -C /lib/modules/3.12.6-1-ARCH/build SUBDIRS=/home/archjun/Downloads/AUR/huion-driver modules
make[1]: Entering directory '/usr/src/linux-3.12.6-1-ARCH'
  CC [M]  /home/archjun/Downloads/AUR/huion-driver/hid-huion.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/archjun/Downloads/AUR/huion-driver/hid-huion.mod.o
  LD [M]  /home/archjun/Downloads/AUR/huion-driver/hid-huion.ko
make[1]: Leaving directory '/usr/src/linux-3.12.6-1-ARCH'

If you get an error like

make[1]: *** /lib/modules/3.12.6-1-ARCH/build: No such file or directory.  Stop.

you probably don't have your linux kernel header package installed, so install that first.

Before running make install as root, unload the existing mainline driver hid-huion (or hid_huion) as follows:

rmmod hid-huion

or

modprobe -r hid-huion

Unplug your H610 if it's connected to your machine, and run make install as root:

[archjun@archbang huion-driver]$ sudo make install
make -C /lib/modules/3.12.6-1-ARCH/build SUBDIRS=/home/archjun/Downloads/AUR/huion-driver modules_install
make[1]: Entering directory '/usr/src/linux-3.12.6-1-ARCH'
  INSTALL /home/archjun/Downloads/AUR/huion-driver/hid-huion.ko
  DEPMOD  3.12.6-1-ARCH
make[1]: Leaving directory '/usr/src/linux-3.12.6-1-ARCH'
install -D -m 0644 hid-huion.conf /etc/depmod.d/hid-huion.conf
depmod -a
install hid-rebind /sbin
install -m 0644 hid-rebind.rules /lib/udev/rules.d/70-hid-rebind.rules
udevadm control --reload

Now if you plug your H610 back in, you should find that it works smoothly with a recent kernel! I recommend using this driver instead of trying to use the native Linux drivers provided by Huion  - they don't even provide a makefile and expect desperate users to edit various C source files themselves!

BTW, the developer of this driver needs your help -- he says he cannot submit to mainline before verifying that it also works with the Huion 580, K58, and W58. If anyone happens to own these models, please contact the DIGIMEND project devs or the DIGIMEND project mailing list once you have verified the out-of-tree driver works for these older models, too.

Postscript 2014-04-08: One thing that is a bit cumbersome is that every time you upgrade your kernel (which is quite frequent in the case of Archlinux) you will have to remove the existing driver hid-huion and reinstall the out-of-tree DIGIMEND huion-driver once again...

Postscript 2014-09-27: huion-driver has been superseded by the digimend-kernel-drivers repository. All the commands above still apply, however just substitute the new repo name when using git clone.

Postcript 2014-10-25: Just a few days ago, Linux kernel 3.17.1-1 was made available in the default Archlinux repos and I can confirm that the Huion H610 now works OOTB (Out Of the Box) without the need to compile any out-of-tree drivers. Developer Nikolai Kondrashov's kernel patch for Huion devices was accepted at the end of July 2014 and he said it would be included in the mainline kernel starting from 3.17.X -- now everything works like a charm!