Re: [DIGImend-users] Huion 610p tablet and hardware buttons
Brought to you by:
spb_nick
From: Christopher B. <chr...@gm...> - 2015-03-26 13:25:41
|
On Wed, 25 Mar 2015 15:13:08 +0100 co...@pi... wrote: >Dear Alec, > >Some times ago, I had a discussion with someone on how to map the >button of the tablet, here is the solution we came up with : > >(a little disclaimer: I am not exactly a computer scientist and I have >managed to make the key "work" but it is not really clean and I won't >be able to explain every step in depth ^^. >A documentation that has helped me a lot is available on the arch >wiki : https://wiki.archlinux.org/index.php/Map_scancodes_to_keycodes) > >Anyway, here is the full process I have followed : >1. First, you need to identify the vendor_id and product_id of your >tablet by looking for it in the usb device list (with the 'lsusb' >command), my vendor ID is 256C and my product ID is 006E. I guess they >are the same for you but you may want to check. >2. Then, you can create the .hwdb file containing your rules in >/etc/udev/hwdb.d >I have called mine huion.hwdb >Before writing the rules for the tablet, you need to specify that >those rules will apply to this device by specifying its ID as : >keyboard:usb:v256Cp006E* > KEYBOARD_KEY_700e0=unknown # This is a rule, see below > >After the first line, each rule line begins with a space. A rule is >defined on the left of the equality by the input key and on the right >by the new key you want to have. >3. To identify scancodes, I have used the command 'evtest' in root. It >asks you to choose the right device, for some reasons I had several >huion tablet listed, so I tried them all and used the one that >actually responded to the input buttons. >You can find in the attached file the output I get when I press the >eraser button. >The first 5 lines seem to be triggered by the push down of the button >and the last 5 ones by the release. > >The first line say that the first key to be pressed has the code 700e1 >and the following line tells us that it is LEFT_SHIFT. >Then the two following lines say that the key KPMINUS is pressed and >its code is 70056 >Hence, by default, pressing the eraser button leads to "shift"+ "-" >which is not exactly what I want. And by testing the other buttons you >will see that each one uses some key modifier like Alt or Ctrl. > >4. Now that you have identified the inputs associated to this button, >you can remap it in your .hwdb file >--> From this point I have made very personal choices that you may >want to change ^^ >I have decided to get rid of the modifier keys "shift", "alt" and >"ctrl" so I have first mapped them to the key "rightctrl" (I did not >find a way to completely discard these inputs), and then I have >assigned the other inputs to key that are not on my keyboard : f13->f21 > >Here is my .hwdb file : > >keyboard:usb:v256Cp006E* > KEYBOARD_KEY_700e0=rightctrl # map ctrl to something useless like >rightctrl > KEYBOARD_KEY_700e1=rightctrl # shift -> rightctrl > KEYBOARD_KEY_700e2=rightctrl # alt -> rightctrl > KEYBOARD_KEY_7003d=f13 # back button -> f13 > KEYBOARD_KEY_70016=f14 # eraser --> f14 > KEYBOARD_KEY_70056=f15 # pencil --> f15 > KEYBOARD_KEY_70057=f16 # + --> f16 > KEYBOARD_KEY_7000a=f17 # - -->f17 > KEYBOARD_KEY_70019=f18 # pencil + --> f18 > KEYBOARD_KEY_7001b=f21 # pencil - --> f21 > KEYBOARD_KEY_70006=f20 # hand --> f20 > >I have assigned the inputs to keys that are not on my keyboard to be >able to use the same button for different shortcut depending on the >used application by using "autokey" which enables to remap (again...) >keys to others depending on the current application. > >(For autokey, see for instance >http://www.howtogeek.com/howto/26913/how-to-customize-shortcut-keys-for-any-linux-application/ >) > >5. to load the rules you must do (as root) : > >udevadm hwdb --update >udevadm trigger > >6. You can check your rules by launching evtest again. > >I think that there is a cleaner way to proceed, especially concerning >the modifier keys, but it seems to work... >I hope this helps! > > Nice and concise writeup - thanks a lot! You should write manuals for a living :) -- Regards, Christopher Barry Random geeky fortune: The human race has one really effective weapon, and that is laughter. -- Mark Twain |