Git Product home page Git Product logo

huion_kamvas_linux's Introduction

Python based Linux driver for Huion Kamvas Pro devices

This is a userspace python based evdev driver for Huion Kamvas Pro devices so that they can be used on Linux machines which don't have officially supported driver.

I personally own a Huion Kamvas Pro 13 and I have tested this driver successfully with that device. The driver should hopefully also be usable with other Huion Kamvas devices, but they havn't been tested.

Feel free to open an issue if you ran into trouble or write me a message if you found this useful.

Features

This script uses a simple YAML configuration file to give you control over how your graphics tablet interacts with your computer. This configuration file is located at ~/.kamvas_config.yaml.

With this driver you can:

  • Define actions for every button on your tablet, even for pen touch. Actions can be defined for the following events
    • Pen click on the screen
    • Pen Buttons
    • Tablet buttons
    • Scrollbar levels
    • Scrollbar increment
    • Scrollbar decrement
  • Manage button action profiles that you can easily switch between
  • Automatically map the driver output to a desired display if you have multiple monitors. NOTE This uses xinput so you will need to have that installed on your system for this functionality to work
  • The driver is automatically stopped when the USB device is unplugged and gets automatically started when it gets plugged in again

Setup

  • You will need to install the following packages from your distribution (Archlinux commands shown here)

    • Python 3: This script was tested with Python 3. It might run just fine on Python 2 if you can install the required python modules

      sudo pacman -S python3
      
    • xf86-input-evdev: This is the Digimend evdev package which adds X events relevant to graphics tablets and makes them available to other apps

      sudo pacman -S xf86-input-input-evdev
      
  • Install the driver module

    pip3 install kamvas-driver
    
  • Update your /etc/X11/xorg.conf file (create it if it is not already there):

    Section "InputClass"
        Identifier "evdev tablet catchall"
        MatchIsTablet "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
    EndSection
    
  • You might need to make sure that the DIGImend kernel driver are not loaded. Unload them using this command

    sudo rmmod hid-uclogic
    
  • Setup a default configuration file for the driver

    kamvas -c
    

Usage

  • Start the driver

    kamvas start
    
  • Stop the driver

    kamvas stop
    

Configuration

You can create a default configuration file at ~/.kamvas_config.yaml using the following command

kamvas -c

You can edit ~/.kamvas_config.json file to define your custom settings for your graphics tablet. The config file allows you to define the following:

  • Actions that must be performed when a button is clicked
    • The script uses evdev events to perform these actions so the values for these actions can be any commands starting with KEY_ or BTN_. For example:

      • Use KEY_A to effectively simulate the presseing of the a key on your keyboard
      • You can also combine events like KEY_LEFTSHIFT+KEY_A to effectively press Shift+a when that action is fired
    • You can use the following command to observe which evdev events are fired when you press keys on your device. You will need to figure out the path of the event file for the device you are trying to test. It is usually located in /dev/input/. You can also try looking for it by name in /dev/input/by-id/ and /dev/input/by-path/

      kamvas -t <path_to_event_file>
      
    • Leave the actions field empty if you don't to perform any action for that even

      • For example: You might not want actions to be performed when you touch the pen to the screen and want it behave like a normal mouse click. But the option if available in case you do want perform an action in that case.
    • You can also define multiple action groups. See the config.json to see an example.

  • The default_display field automatically maps your driver output to a given system display name (like HDMI1, DVI1, etc)
    • This feature required xinput to be installed on your system
    • Remove this field if you do not have xinput installed or are just using a single display
    • If you have multiple displays and you do not use this field then the output from your graphics tablet will be mapped to all the displays by default
  • The default_action field defines the button actions group that will be used by the driver if kamvas start -a=<action_name> is not used to start the driver
  • Capabilies of your graphics tablet (like its resolution, pressure sensitivity, etc)
    • You will most likely not need to change this but might be useful if you are trying to adapt this driver to some other device
    • These fields are
      • xinput_name
      • vendor_id
      • product_id
      • pen
    • If you do need to redefine these values that try
      • kamvas -o to print driver output as it happens
        • You might need to dig into the code and make sure to pass in the -r or -c options to the driver subprocess
        • -r will allow you to monitor raw USB data as it comes in
        • -c will allow you to monitor the calculated values being sent to the system by the driver
      • kamvas -u which will print some USB information as the device gets plugged in or removed
      • Digimend uclogic-tools. Specifically, try using uclogic-probe | uclogic-decode

Known Issues

  • The driver is unable to survive a system suspend or hibernate event
    • On resume, it will continue to show that the driver is running but the cursor will be unresponsive if you try to use the device

    • You will have to stop the driver and start it again

      kamvas stop
      kamvas start
      

huion_kamvas_linux's People

Contributors

mantaseus avatar

Stargazers

ーーー avatar Pearl avatar  avatar Gregg avatar  avatar Hunter The Protogen avatar  avatar jeacom25b avatar Philipp Huth avatar Bogus curry avatar  avatar

Watchers

Bogus curry avatar James Cloos avatar  avatar Philipp Huth avatar

huion_kamvas_linux's Issues

How to configure my Kamvas 13 pro to work as the 3rd screen in a multi-monitor setup?

I've been trying to configure my Kamvas 13 pro to work as the 3rd screen in a multi-monitor setup, with 3 screens side by side.

I believe this should be possible by simply changing the minimum X value to 3840.

Currently the pen x position on the left side of the Kamvas translates to an x position across the far left of the first screen while a pen x position on the right side of the Kamvas will be correctly tracked.

Unfortunately even after editing ecodes.EV_ABS min value for X to 3820, it doesn't seem to have any effect.

What would be the correct parameter to edit so that the pointer x position remains within the Kamvas screen area?

Thank you for your advice!

action missing in config file

Thank you for creating this great Linux driver for the Kamvas 13 Pro.

While setting it up I found that the action named "action" was missing from the config.json file.

However it worked once I edited kamvas_driver.py to use the action named "krita".

Huion Pro 13 input not working

Hello,

I've succesfully installed this driver, and I can start it with kamvas start. But, when I move the stylus on the tablet, the cursor is not moving. The tablet works fine as a second screen though.

This is what I get from lsusb:

~ $ lsusb                                                            
Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub   
Bus 001 Device 002: ID 8087:8008 Intel Corp.                                  
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub   
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub   
Bus 003 Device 008: ID 256c:006d                                                    
Bus 003 Device 006: ID 1b1c:1b34 Corsair                                       
Bus 003 Device 005: ID 1b1c:1b49 Corsair                                       
Bus 003 Device 004: ID 096e:0858 Feitian Technologies, Inc.          
Bus 003 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub  
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub   

The entry 256c:006d is the one for my tablet. Also, this is what I get with xinput:

~ $ xinput
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ckb1: CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard vKB id=8    [slave  pointer  (2)]
⎜   ↳ ckb1: CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard vM  id=9    [slave  pointer  (2)]
⎜   ↳ ckb2: Corsair Gaming GLAIVE RGB Mouse vKB id=10   [slave  pointer  (2)]
⎜   ↳ ckb2: Corsair Gaming GLAIVE RGB Mouse vM  id=11   [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)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ ckb1: CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard vKB id=12   [slave  keyboard (3)]
    ↳ ckb1: CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard vM  id=13   [slave  keyboard (3)]
    ↳ ckb2: Corsair Gaming GLAIVE RGB Mouse vKB id=14   [slave  keyboard (3)]
    ↳ ckb2: Corsair Gaming GLAIVE RGB Mouse vM  id=15   [slave  keyboard (3)]

Is there any more info I can give you to help me troubleshoot it?

I'm using Ubuntu 18.04
Thanks.

Huion Kamvas 16 Pro on Raspberry Pi 3 (Pi Os) n ot working

Hi,

i own a Huion Kamvas 16 pro Tablet and want to use it with the raspberry pi 3 and Gimp.
The Huion Tablet is connected at the HDMI port (Touchscreen) and the USB-POrt (Pen).

Touchscreen and pen work fine (directly after haveing installed the newest Pi OS Operation system.
Butt unfortunately, the hardware-keys (left-hand of tablet) don#t work.

Gladfully i found your project and hope to get the keys working with your driver.
But all attempts have failed so far, which is why I am now trying to contact you directly. It would be mega great if you could help me.

What i have already done / tried:

i have created the /etc/X11/xorg.conf file and put in the following lines:

Section "InputClass"
Identifier "evdev tablet catchall"
MatchIsTablet "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection

Then I installed the kamvas-driver via

pip3 install kamvas-driver

and then created the default config-file (.kamvas_config.yaml).
In your instructions there is a passage which mentions a kamvas_config,json file, but i think you mean the .yaml file?

Anyway:

When i start the driver by kamvas start command the message "driver is started" is displayed.
The pen works still fine but the Keys of the tablet don't.
This confuses me, because i didn't yet edit the config file and my product_id is different from the one set in the default config i think.

So in the config file I edited the following variables:
xinput_name, vendor_id and product_id.

I executed xinput -list to get this data (is this the correct way?):
I get the following output:

pi@raspberrypi:~ $ xinput -list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ HID 256c:006d Pen Pen (0) id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ HID 256c:006d Pen

so I think the xinput_name is "HID", the vendor_id is "256c" and the product_id is "006d" is that correct?

Anyway, if i use this values in the config file, i get the following output

pi@raspberrypi:~ $ kamvas start
Driver started
pi@raspberrypi:~ $ Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/driver/kamvas_driver.py", line 389, in
if not args['--quiet-mode']:
NameError: global name 'args' is not defined

And always when i do kamvas stop command i get

pi@raspberrypi:~ $ kamvas stop
Traceback (most recent call last):
File "/home/pi/.local/bin/kamvas", line 6, in
from driver.cli import run_main
ModuleNotFoundError: No module named 'driver'

Do you have further tips for me to get this thing work?

Best wishes
Daniel

P.S.: I hope u understand my english...my german is much better ;-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.