I have just bought HUION Inspiroy 2 tablet. I have used pamac build huiontablet
command to install the driver. I am able to write but its driver is not allowing to customize tablet keys in Manjaro Linux . Can i write its driver in Julia so that i can customize its Keys? How much time it may take to create this software ?
Can you see all the key presses you are interested in with the xev
application program (the X11 event viewer tool)? If yes, you don’t need a new device driver, because the X11 server has got the required information from the current driver already.
What do you mean by xev
application program ?
Yes , When i click on keys they work as shown in picture below. I want to assign different function to those keys.
What do you mean by
xev
application program
You start xev simply by typing xev
into a shell, hover the mouse over it’s little white window and it will then show you on stdout for each keyboard keystroke or mouse/tablet button click a KeyPress/KeyRelease or a ButtonPress/ButtonRelease event sent by the X11 server to applications. KeyPress/KeyRelease events contain both the “keycode” provided by the device driver, as well as the “keysym” mapped onto that key by a keysym mapping table managed by the X11 server. You can change the keycode->keysym mapping with the command-line tool xmodmap
.
Questions you may want to answer:
- Which type of display server are you using? There are two: an older one known as “MIT X11” or “The X Window System”, and a newer one known as “Wayland”. (I personally still know very little about Wayland, as I haven’t used it yet, but the Linux world is in the middle of transitioning from X11 to Wayland, which can complicate things a bit.)
- If you are using an X11 application and display server: is the driver sending KeyPress or ButtonPress events for the keys/buttons that you are interested in?
(None of this, by the way, has anything to do with Julia. Julia isn’t really a language suitable for writing kernel device drivers, something that is (almost) entirely done in C. But I strongly suspect you don’t actually need a new device driver, and can use existing mapping mechanisms to do what you want.)
Here some example web pages describing key/button re-mapping facilities in X11:
See output. I can see all key presses with xev
application program.
KeyRelease event, serial 38, synthetic NO, window 0xa00001,
root 0x403, subw 0x0, time 2253646, (1010,387), root:(1010,455),
state 0x1c, keycode 52 (keysym 0x7a, z), same_screen YES,
XLookupString gives 1 bytes: (1a) “�”
XFilterEvent returns: False
KeyRelease event, serial 38, synthetic NO, window 0xa00001,
root 0x403, subw 0x0, time 2253646, (1010,387), root:(1010,455),
state 0x1c, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 38, synthetic NO, window 0xa00001,
root 0x403, subw 0x0, time 2253646, (1010,387), root:(1010,455),
state 0x14, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
May the change in the keycode->keysym mapping of Tablet affect keyboard and mouse also?
Display server of my Manajro Linux is X11.
~ echo $DESKTOP_SESSION
gnome-xorg
~ echo $XDG_SESSION_TYPE
x11
~ cat /sys/bus/usb/devices/*/product 1 ✘
Usb Mouse
USB Keyboard
Integrated_Webcam_HD
USB2.0-CRW
Huion Tablet_H641P
EHCI Host Controller
xHCI Host Controller
xHCI Host Controller
List of my Tablet properties
~ xinput list ✔
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Synaptics s3203 id=15 [slave pointer (2)]
⎜ ↳ Huion Mouse id=23 [slave pointer (2)]
⎜ ↳ SIGMACHIP Usb Mouse id=10 [slave pointer (2)]
⎜ ↳ SZH USB Keyboard Consumer Control id=13 [slave pointer (2)]
⎜ ↳ HUION Huion Tablet_H641P Keyboard id=24 [slave pointer (2)]
⎜ ↳ HUION 256C PEN STYLUS Pen (0) id=26 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Integrated_Webcam_HD: Integrate id=14 [slave keyboard (3)]
↳ Dell WMI hotkeys id=16 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=17 [slave keyboard (3)]
↳ Huion Tablet id=19 [slave keyboard (3)]
↳ Huion Tablet id=20 [slave keyboard (3)]
↳ Huion keyboard id=22 [slave keyboard (3)]
↳ HUION 256C PEN STYLUS id=21 [slave keyboard (3)]
↳ SZH USB Keyboard System Control id=11 [slave keyboard (3)]
↳ SZH USB Keyboard id=12 [slave keyboard (3)]
↳ SZH USB Keyboard Consumer Control id=18 [slave keyboard (3)]
↳ HUION Huion Tablet_H641P Keyboard id=25 [slave keyboard (3)]
~ xinput list-props 20 ✔
Device 'Huion Tablet':
Device Enabled (166): 1
Coordinate Transformation Matrix (168): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix (524): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix Default (525): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (280): 1, 0
libinput Send Events Mode Enabled (281): 0, 0
libinput Send Events Mode Enabled Default (282): 0, 0
Device Node (283): "/dev/input/event19"
Device Product ID (284): 9580, 65535
~ xinput list-props 24 ✔
Device 'HUION Huion Tablet_H641P Keyboard':
Device Enabled (166): 1
Coordinate Transformation Matrix (168): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Natural Scrolling Enabled (295): 0
libinput Natural Scrolling Enabled Default (296): 0
libinput Rotation Angle (278): 0.000000
libinput Rotation Angle Default (279): 0.000000
libinput Send Events Modes Available (280): 1, 0
libinput Send Events Mode Enabled (281): 0, 0
libinput Send Events Mode Enabled Default (282): 0, 0
Device Node (283): "/dev/input/event24"
Device Product ID (284): 9580, 102
libinput Drag Lock Buttons (319): <no items>
libinput Horizontal Scroll Enabled (320): 1
libinput High Resolution Wheel Scroll Enabled (323): 1
~ xinput list-props 26 ✔
Device 'HUION 256C PEN STYLUS Pen (0)':
Device Enabled (166): 1
Coordinate Transformation Matrix (168): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (280): 1, 0
libinput Send Events Mode Enabled (281): 0, 0
libinput Send Events Mode Enabled Default (282): 0, 0
Device Node (283): "/dev/input/event20"
Device Product ID (284): 9580, 61165
libinput Tablet Tool Pressurecurve (600): 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000, 1.000000
libinput Tablet Tool Area Ratio (601): 0, 0
~ xinput list-props 21 ✔
Device 'HUION 256C PEN STYLUS':
Device Enabled (166): 1
Coordinate Transformation Matrix (168): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (280): 1, 0
libinput Send Events Mode Enabled (281): 0, 0
libinput Send Events Mode Enabled Default (282): 0, 0
Device Node (283): "/dev/input/event20"
Device Product ID (284): 9580, 61165
~ xinput list-props 22 ✔
Device 'Huion keyboard':
Device Enabled (166): 1
Coordinate Transformation Matrix (168): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Rotation Angle (278): 0.000000
libinput Rotation Angle Default (279): 0.000000
libinput Send Events Modes Available (280): 1, 0
libinput Send Events Mode Enabled (281): 0, 0
libinput Send Events Mode Enabled Default (282): 0, 0
Device Node (283): "/dev/input/event21"
Device Product ID (284): 9580, 65535
I want my tablet’s scroll wheel to use for scrolling but by default currently scroll wheel is assigned to zoom in/out work. Also make lower key of stylus to behave as “Left Click” of mouse.
In which application do you want to change the role of the wheel? Does your application use libinput to process events from your tablet?
Also try sudo libinput debug-events
(possibly after installing a package called libinput-tools or similar), so see what kind of libinput events your wheel generates.
I want to change role of my tablet wheel in every application be it web browser or PDF reader. The output of sudo libinput debug-events
command is shown below :
From a quick look at the files in the driver package you linked, with
$ gdebi-gtk HuionTablet_v15.0.0.107.202209081050.x86_64.deb
I can’t actually see anything resembling a “driver” (as in “loadable Linux kernel module”) in there. All the package installs is a udev
configuration file /usr/lib/udev/rules.d/20-huion.rules
which will cause the kernel to connect its standard uhid
and uinput
drivers to that tablet device when it is plugged in. And the package installs two applications programs called huionCore
and huiontablet
. I suspect the latter is just a GUI to help users to do basic configuration of the existing general-purpose Linux input drivers. In that case, you just need to explore the relevant standard Linux input configuration mechanisms to make the tweaks you want.
Can you tell me some resources from where i can learn about those things ?
The way the X11 server and its drivers are configured is documented in
https://www.x.org/releases/X11R7.5/doc/man/man5/xorg.conf.5.html
This also has a reference to
https://www.x.org/releases/X11R7.5/doc/man/man4/evdev.4.html
which is the generic keyboard/mouse driver it uses on Linux, and that lists some ButtonMapping
and also some options on mapping wheel axis and emulating wheel events that might be useful to experiment with.
If I rotate my normal Microsoft IntelliMouse wheel, then xev
shows me that these events arrive at the application as “button 4 pressed and released” events when I roll the wheel upwards (away from me), and “button 5 pressed and released” when I roll the wheel downwards. These mouse button 4 and 5 events also cause my web browser to scroll the web page up and down. So presumably all you might need to do is to map the wheel movements of your tablet device onto mouse button 4 and 5 events.
Since Manjaro Linux is derived from Arch Linux, a distribution-specific starting point for configuring your X11 server (i.e., where to create such .conf files) is
https://wiki.archlinux.org/title/xorg#Configuration
In my laptop -event4
is related to mouse.
~ sudo libinput debug-events ✔
-event3 DEVICE_ADDED Power Button seat0 default group1 cap:k
-event13 DEVICE_ADDED Video Bus seat0 default group2 cap:k
-event1 DEVICE_ADDED Power Button seat0 default group3 cap:k
-event0 DEVICE_ADDED Lid Switch seat0 default group4 cap:S
-event2 DEVICE_ADDED Sleep Button seat0 default group5 cap:k
-event4 DEVICE_ADDED SIGMACHIP Usb Mouse seat0 default group6 cap:p left scroll-nat scroll-button
-event5 DEVICE_ADDED SZH USB Keyboard seat0 default group7 cap:k
-event6 DEVICE_ADDED SZH USB Keyboard Consumer Control seat0 default group7 cap:kp scroll-nat
-event8 DEVICE_ADDED SZH USB Keyboard System Control seat0 default group7 cap:k
-event12 DEVICE_ADDED Integrated_Webcam_HD: Integrate seat0 default group8 cap:k
-event17 DEVICE_ADDED Synaptics s3203 seat0 default group9 cap:pg size 102x57mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on
-event9 DEVICE_ADDED Dell WMI hotkeys seat0 default group10 cap:k
-event7 DEVICE_ADDED AT Translated Set 2 keyboard seat0 default group11 cap:k
-event4 POINTER_BUTTON +0.000s BTN_RIGHT (273) pressed, seat count: 1
event4 POINTER_BUTTON +0.160s BTN_RIGHT (273) released, seat count: 0
event4 POINTER_BUTTON +1.776s BTN_LEFT (272) pressed, seat count: 1
event4 POINTER_BUTTON +1.848s BTN_LEFT (272) released, seat count: 0
event4 POINTER_SCROLL_WHEEL +3.184s vert -15.00/-120.0* horiz 0.00/0.0 (wheel)
event4 POINTER_SCROLL_WHEEL +5.488s vert 15.00/120.0* horiz 0.00/0.0 (wheel)
event4 POINTER_SCROLL_WHEEL +5.656s vert 15.00/120.0* horiz 0.00/0.0 (wheel)
event4 POINTER_SCROLL_WHEEL +7.480s vert -15.00/-120.0* horiz 0.00/0.0 (wheel)
-event5 KEYBOARD_KEY +10.775s KEY_SYSRQ (99) pressed
That likely refers to the device file /dev/input/event4
, which the kernel has allocated for delivering events from that device to user-space software.
@mgkuhn Output on attaching tablet and rolling its scroler. This file/dev/input/event4
is of zero byte.
~ ~ sudo libinput debug-events ✔
event18 - HUION Huion Tablet_H641P Pen: libinput bug: missing tablet capabilities: resolution. Ignoring this device.
-event3 DEVICE_ADDED Power Button seat0 default group1 cap:k
-event13 DEVICE_ADDED Video Bus seat0 default group2 cap:k
-event1 DEVICE_ADDED Power Button seat0 default group3 cap:k
-event0 DEVICE_ADDED Lid Switch seat0 default group4 cap:S
-event2 DEVICE_ADDED Sleep Button seat0 default group5 cap:k
-event19 DEVICE_ADDED HUION Huion Tablet_H641P Keyboard seat0 default group6 cap:kp scroll-nat
-event4 DEVICE_ADDED SIGMACHIP Usb Mouse seat0 default group7 cap:p left scroll-nat scroll-button
-event5 DEVICE_ADDED SZH USB Keyboard seat0 default group8 cap:k
-event6 DEVICE_ADDED SZH USB Keyboard Consumer Control seat0 default group8 cap:kp scroll-nat
-event8 DEVICE_ADDED SZH USB Keyboard System Control seat0 default group8 cap:k
-event12 DEVICE_ADDED Integrated_Webcam_HD: Integrate seat0 default group9 cap:k
-event17 DEVICE_ADDED Synaptics s3203 seat0 default group10 cap:pg size 102x57mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on
-event9 DEVICE_ADDED Dell WMI hotkeys seat0 default group11 cap:k
-event7 DEVICE_ADDED AT Translated Set 2 keyboard seat0 default group12 cap:k
-event19 KEYBOARD_KEY +0.000s *** (-1) pressed
event19 KEYBOARD_KEY +0.000s *** (-1) pressed
= event19 KEYBOARD_KEY +0.012s *** (-1) released
event19 KEYBOARD_KEY +0.012s *** (-1) released
event19 KEYBOARD_KEY +1.578s *** (-1) pressed
event19 KEYBOARD_KEY +1.578s *** (-1) pressed
event19 KEYBOARD_KEY +1.590s *** (-1) released
event19 KEYBOARD_KEY +1.590s *** (-1) released