Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uclogic: Add support for Parblo A640 #393

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

spbnick
Copy link
Member

@spbnick spbnick commented May 17, 2020

No description provided.

@Delhi-Babu
Copy link

Delhi-Babu commented May 17, 2020

hey spbnick first of all greetings if you are developing form the #385 issue for parblo a640 thanks
but the dumps given by him is comeplety different form mine(not fully but partially)
I have different report id's but I am sure I am usign the same tablet
here is the link
for my dumps
litreally I was trying to build the thing by watching your videos I have viewed your confrence talks and your youtube videos

@hyiltiz
Copy link

hyiltiz commented May 17, 2020

Hmm, could @DONofDESTROY specify which of the dumps different, and if possible to specify, in what respect? I wonder if the order of pressing buttons etc. was different.

What I did

  1. booted with A640 unplugged.
  2. download the .zip above,
  3. make dkms_uninstall to remove the old version
  4. make dkms_install
  5. modprobe -r hid-kye hid-uclogic hid-polostar hid-viewsonic; modprobe -r bcm5974 ; modprobe -a bcm5974
  6. now plug in A640
  7. check dmesg output (tail pasted below)
  8. use the Stylus pen on it when Konsole was open in the screen

Results

  1. Konsole did not crash (nor did Krita or MyPaint)
  2. No response to the stylus movements aka mouse didn't move (no response in Krita/MyPaint brushes)
$ dmesg # uclogic has been detected
...
[300597.385516] usbcore: registered new interface driver bcm5974
[300627.777067] usb 1-2: new full-speed USB device number 6 using xhci_hcd
[300627.926554] usb 1-2: New USB device found, idVendor=5543, idProduct=0061, bcdDevice= 0.00
[300627.926559] usb 1-2: New USB device strings: Mfr=5, Product=6, SerialNumber=0
[300627.926561] usb 1-2: Product: A640
[300627.926563] usb 1-2: Manufacturer: UC-Logic
[300627.930912] input: UC-Logic A640 as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:5543:0061.000C/input/input36
[300627.931109] input: UC-Logic A640 Mouse as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:5543:0061.000C/input/input37
[300627.931321] hid-generic 0003:5543:0061.000C: input,hiddev2,hidraw3: USB HID v1.11 Mouse [UC-Logic A640] on usb-0000:00:14.0-2/input0
[300627.933230] input: UC-Logic A640 Mouse as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/0003:5543:0061.000D/input/input38
[300627.933418] input: UC-Logic A640 as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/0003:5543:0061.000D/input/input39
[300627.933649] hid-generic 0003:5543:0061.000D: input,hiddev3,hidraw6: USB HID v1.11 Mouse [UC-Logic A640] on usb-0000:00:14.0-2/input1
[300627.934809] input: UC-Logic A640 Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.2/0003:5543:0061.000E/input/input40
[300627.993366] input: UC-Logic A640 Consumer Control as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.2/0003:5543:0061.000E/input/input41
[300627.993597] input: UC-Logic A640 System Control as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.2/0003:5543:0061.000E/input/input42
[300627.993892] hid-generic 0003:5543:0061.000E: input,hidraw7: USB HID v1.11 Keyboard [UC-Logic A640] on usb-0000:00:14.0-2/input2
[300628.686996] input: UC-Logic A640 Pen as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:5543:0061.000C/input/input43
[300628.687218] input: UC-Logic A640 Pad as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:5543:0061.000C/input/input44
[300628.687423] uclogic 0003:5543:0061.000C: input,hidraw3: USB HID v1.11 Keypad [UC-Logic A640] on usb-0000:00:14.0-2/input0
[300628.766329] input: UC-Logic A640 Mouse as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/0003:5543:0061.000D/input/input45
[300628.767028] uclogic 0003:5543:0061.000D: input,hiddev2,hidraw6: USB HID v1.11 Mouse [UC-Logic A640] on usb-0000:00:14.0-2/input1
[300628.917566] uclogic 0003:5543:0061.000E: interface is invalid, ignoring
[300628.945305] uclogic 0003:5543:0061.000E: interface is invalid, ignoring
[300654.700132] usb 1-2: input irq status -75 received
[300654.712117] usb 1-2: input irq status -75 received
[300654.724123] usb 1-2: input irq status -75 received
[300654.740087] usb 1-2: input irq status -75 received
[300654.752121] usb 1-2: input irq status -75 received
...



$ lsmod | grep uclogic # digimend dkms seemed to have kicked in since hid_uclogic is now used by usbhid
hid_uclogic            40960  0
usbhid                 65536  1 hid_uclogic
hid                   147456  5 usbhid,hid_apple,hid_uclogic,hid_generic,hid_appleir
usbcore               315392  9 xhci_hcd,ehci_pci,usbhid,hid_uclogic,bcm5974,uvcvideo,ehci_hcd,btusb,xhci_pci



$ cat /etc/X11/xorg.conf.d/50-tablet-dynamic.conf # using the USBID for xorg.conf file
Section "InputClass"
# https://github.com/DIGImend/digimend-kernel-drivers/issues/296
# Uncommented /usr/share/X11/xorg.conf.d/libinput entry matching tablet catchall
    #Identifier "Parblo UC-Logic A640 stylus with wacom driver"
    Identifier "A640 stylus"
    # Identifier "ParbloA640"
    # result from lsusb
  MatchUSBID "5543:0061"
    # registers as /dev/input/event8 when plugged into the 2nd USB port
    # Created wacom-pen using udev rules: /etc/udev/rules.d/60-wacom.rules
    #MatchDevicePath "/dev/input/wacom-pen" 
    Option "ModeDebug" "On"
    Option "DebugLevel" "1"
    Option "CommonDBG" "1"
    Driver "wacom"
    Option "Type" "stylus"
EndSection

Section "InputClass"
# https://github.com/DIGImend/digimend-kernel-drivers/issues/296
# Uncommented /usr/share/X11/xorg.conf.d/libinput entry matching tablet catchall
    Identifier "A640 pad"
    # Identifier "ParbloA640"
    # result from lsusb
    MatchUSBID "5543:0061"
    # registers as /dev/input/event8 when plugged into the 2nd USB port
    # MatchDevicePath "/dev/input/wacom-keyboard"
    Option "ModeDebug" "On"
    Option "DebugLevel" "1"
    Option "CommonDBG" "1"
    Driver "wacom"
    Option "Type" "pad"
EndSection

# Section "ServerLayout"
# # https://github.com/linuxwacom/xf86-input-wacom/wiki/Configuring-X#static-xorgconf-setup
#   Identifier    "50-tablet.conf Configured"
#   InputDevice "ParbloA640"
# EndSection



$  ls /etc/udev/rules.d/60-wacom.rules* # my custom udev rules are disabled
/etc/udev/rules.d/60-wacom.rules.bac-static



$ xsetwacom list # only pad is detected
UC-Logic A640 Pad                       id: 19  type: PAD



$ xsetwacom --set 19 Button 8 "key ctrl z" # pressing any of the pad's buttons does nothing after this

@Delhi-Babu
Copy link

Delhi-Babu commented May 18, 2020

wait a minute my usb-hid string changes to like yours I guess the dumps I make were from default with no drivers(specified by myself) and yours is digimend or wacom
mine right now

001:003:000:STREAM             1589777601.773038
 07 80 12 37 A4 15 00 00 00 00

(looks like the last two hex bits ie 0x00 and 0x00 are tilt atleast me) and i wonder wether they plan to do that cause on one of the descriptors i saw tilt(from interface 0 without any drives specified by me)

<usage>digitizer_x_tilt<!-- X tilt (3Dh, dynamic value) --></usage>
      <logical_minimum>-127</logical_minimum>
      <logical_maximum>127</logical_maximum>
      <report_size>8</report_size>
      <report_count>1</report_count>
      <input>
        <variable/>
      </input>
      <usage>digitizer_y_tilt<!-- Y tilt (3Eh, dynamic value) --></usage>
      <logical_minimum>-127</logical_minimum>
      <logical_maximum>127</logical_maximum>

(idk it might be proximity bit or even some garbage values)
anyways at first I have different interface for my pen with pen_buttons and for frame buttons totally 3(one unused) but now everything communicates on single interface

@Delhi-Babu
Copy link

Delhi-Babu commented May 18, 2020

issues
as said by @hyiltiz I am not able to move the mouse pointer with the tablet and with only
$ cat /etc/X11/xorg.conf.d/50-tablet.conf
as said in the README.md
Section "InputClass" Identifier "Tablet" Driver "wacom" MatchDevicePath "/dev/input/event*" MatchUSBID "5543:0061" EndSection
now
xsetwacom --list
UC-Logic A640 Pen stylus id: 9 type: STYLUS UC-Logic A640 Pad pad id: 10 type: PAD
and kde applications doesn't crash now

and evtest is not showing any outputs on any events however the unwanted events are hided or not showing

@spbnick
Copy link
Member Author

spbnick commented May 18, 2020

Could you please check that you're actually using the installed driver? You should get 10 out of this command, with tablet plugged in, if you do:

cat /sys/module/hid_uclogic/version

@Delhi-Babu
Copy link

Delhi-Babu commented May 18, 2020

cat /sys/module/hid_uclogic/version
yes It displays 10
for additional info

[  288.175304] usb 1-1.2: USB disconnect, device number 3
[  291.934325] usb 1-1.2: new full-speed USB device number 4 using ehci-pci
[  292.032543] usb 1-1.2: New USB device found, idVendor=5543, idProduct=0061, bcdDevice= 0.00
[  292.032547] usb 1-1.2: New USB device strings: Mfr=5, Product=6, SerialNumber=0
[  292.032550] usb 1-1.2: Product: A640
[  292.032552] usb 1-1.2: Manufacturer: UC-Logic
[  292.035928] input: UC-Logic A640 Pen as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:5543:0061.0004/input/input24
[  292.036197] input: UC-Logic A640 Pad as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:5543:0061.0004/input/input25
[  292.036442] uclogic 0003:5543:0061.0004: input,hidraw0: USB HID v1.11 Keypad [UC-Logic A640] on usb-0000:00:1a.0-1.2/input0
[  292.038521] input: UC-Logic A640 Mouse as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.1/0003:5543:0061.0005/input/input26
[  292.038938] uclogic 0003:5543:0061.0005: input,hiddev0,hidraw1: USB HID v1.11 Mouse [UC-Logic A640] on usb-0000:00:1a.0-1.2/input1
[  292.039909] uclogic 0003:5543:0061.0006: interface is invalid, ignoring
[  292.702366] uclogic 0003:5543:0061.0006: interface is invalid, ignoring
[  295.729809] audit: type=1101 audit(1589792338.505:139): pid=1658 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="donofdestroy" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[  295.730348] audit: type=1110 audit(1589792338.505:140): pid=1658 uid=0 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_unix,pam_permit,pam_env acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[  295.735027] audit: type=1105 audit(1589792338.509:141): pid=1658 uid=0 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[  295.750927] audit: type=1106 audit(1589792338.522:142): pid=1658 uid=0 auid=1000 ses=2 msg='op=PAM:session_close grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[  295.751170] audit: type=1104 audit(1589792338.525:143): pid=1658 uid=0 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_unix,pam_permit,pam_env acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[  312.263439] audit: type=1101 audit(1589792355.035:144): pid=1690 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="donofdestroy" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[  312.263831] audit: type=1110 audit(1589792355.035:145): pid=1690 uid=0 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_unix,pam_permit,pam_env acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[  312.267345] audit: type=1105 audit(1589792355.039:146): pid=1690 uid=0 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'

my dmesg

@spbnick
Copy link
Member Author

spbnick commented May 18, 2020

@DONofDESTROY, do you also get input irq status -75 received in dmesg when trying to use the tablet?

P.S. Please use triple back-ticks for quoting blocks of pre-formatted text, not single ones.

@Delhi-Babu
Copy link

Delhi-Babu commented May 18, 2020

@spbnick yes I am geting that input irq status -75 received
and I am new to Github that's why
additional info
I have deleted my
/etc/X11/xorg.conf.d/50-tablet.conf
to make sure that I didn't use any dirvers apart from digimend

@spbnick spbnick self-assigned this May 18, 2020
@spbnick
Copy link
Member Author

spbnick commented May 18, 2020

OK, I'll have to find some more time to look into the diagnostics you collected and fix this.

@Delhi-Babu
Copy link

Delhi-Babu commented May 18, 2020

@spbnick thanyou
and the diagnostics I have collected is without any driver assigned by myself
you can find it here
and Bare with me cause I included some text in the diagnostics which define about the usb-hid dump what is what
If you want a new unedited diagnostics ask me

@spbnick
Copy link
Member Author

spbnick commented May 18, 2020

Thank you, @DONofDESTROY, and no problem about being new to GitHub :)

@Delhi-Babu
Copy link

Delhi-Babu commented May 18, 2020

and to mention that evest folder is kinda usless I think as the event listed by evtest sometimes changes even it is on the same port without any additonal devices connected after removal of the tablet
TL;DR
the only working events as far as I know were the device_18_mouse
which outputs pens x,y coordinates pressure as well as the buttons of the pen
and the device_12_Uc-logic keyboard which emulates keyboards(I think)
and here is the deep understanding of the outputs given by the usb-hid dumps
Just in cause It helps

002:006:000:STREAM             1589459739.378579
 09 00 DD 0E 68 04 00 00

the pen and pen button use interface 0
0x09 is the report id and that 2nd hex digits specifies pen status
0x00 for hovering
0x01 for pen tip touching in the pad
0x02 for bottom button clicked without touching the tablet pad
0x03 for bottom button clicked with touching the tablet
0x04 for the upper button clicked without touching the tablet
0x05 for the upper button cliked with tip touching the tablet
the successive two hex (0xDD 0x0E)bit define left to right
the successive two hex (0x69 0x04)bit define the top to bottom
the x and y coordinates origins(0,0) starts at the top left corroner of the tablet
the last two digits were the pressure them max is
FF 1F (0x1FFF)which is 8191
this is all on the pen coordinates
the frame buttons use different interface

002:006:002:STREAM             1589460336.217563
 03 01 16 00 00 00 00 00

in which
0x03 is the report id
the next hex bit branch into two
01 which defines the top buttons frame
03 defines the bottom buttons on the frame
for the left top button the succesive bit becomes 0x16 ie (01 16)
for the right top button the successive bit becomes 0x19 ie (01 19)
for the bottom left button the successive bit becomes 0x2D ie (03 2D)
for the bottom right button the successive bit becomes 0x2E ie (03 2E)
when buttons are released everything changes 0x00 except the report id which is 0x03 this applies to all the buttons
in the case of two buttons pressed on the same time IDk this will be useful
ex left top and right top it uses 3 hex bits
ie left top is pressed first and followed by the right top
then 0x01 indicates top button
0x16 cause the left button is pressed first
0x19 this indicates that the 2nd button is the right top button ie (01 16 19)
this applies to the bottom buttons too ie left bottom first and right bottom second returns
(03 2D 2E)
however this is not the case interms of mixing ie left bottom and right bottom or vice versa or left bottom and left top
in this case the hex digits becomes like
01 16(when i press left top button)
03 16 2D(when i press the left top and left bottom together)
when I release the left bottom button first it becomes
00 16 00
when I release the left top button first it becomes
02 2D 00
looks like the hex digt on the first gets subracted by 1
when I press agian it add the 1 which is subracted
this applies to all the mixing combos

and finally I suspect that this tablet might have tilt but it is not advertised as that but I noticed something in the interface 0 xml file

 <input>
        <variable/>
      </input>
      <usage>digitizer_x_tilt<!-- X tilt (3Dh, dynamic value) --></usage>
      <logical_minimum>-127</logical_minimum>
      <logical_maximum>127</logical_maximum>
      <report_size>8</report_size>
      <report_count>1</report_count>
      <input>
        <variable/>
      </input>
      <usage>digitizer_y_tilt<!-- Y tilt (3Eh, dynamic value) --></usage>
      <logical_minimum>-127</logical_minimum>
      <logical_maximum>127</logical_maximum>
      <input>
        <variable/>
      </input>

@hyiltiz
Copy link

hyiltiz commented May 18, 2020

cat /sys/module/hid_uclogic/version

Yes. After an unplug and modprobe -r hid_uclogic, that file disappears; re-plugging it back in shows the same version.

 cat /sys/module/hid_uclogic/version
10

Ready for any more tests. Really appreciate your support in this.

@Delhi-Babu
Copy link

Delhi-Babu commented May 19, 2020

hey @spbnick today I played with the driver and found a thing
It might be useful or idk I thought it is worth mentioning that here

I forked digimend and when give value to rc with tablets that have report id 0x09 my mouse cursor moves with the tablet
I tried buch include ex07 which generates report id 0x07 and this pull request also generate report id 0x07

to say short I think the cursor moves when the report id is 0x09 but I am not sure
but still no pressure my evtest reports that

/dev/input/event12:	UC-Logic A640
/dev/input/event13:	UC-Logic A640 Mouse

and
$ lsmod |grep -i uclogic gives

hid_uclogic            40960  0
usbhid                 65536  1 hid_uclogic
hid                   143360  3 usbhid,hid_uclogic,hid_generic

anyways here is the changes I made

@hyiltiz
Copy link

hyiltiz commented May 19, 2020

From my experiments digging around the usbhid interface exported in /sys before this patch, the tablet has a messy USB interface with a bunch of duplicated interfaces for the pointer. It changed depending on whether there was a replug and whether it was plugged before a reboot. Not sure if that is relevant in writing hit_uclogic.

@Delhi-Babu
Copy link

Delhi-Babu commented May 21, 2020

@spbnick finally I made a working prototype of the tablet with working pressure,I need your guidence in this and
as I suspected
The tablet has tilt
poc
@hyiltiz pls check this I am not sure that pad buttons were supported in this patch
here
thanks to weimens I reused his code and I think that his PR can be merged to digimend

@hyiltiz
Copy link

hyiltiz commented May 21, 2020

Tested out 0468d77 by make dkms_uninstall then make dkms_install, then plugged in the device. hid_uclogic is automatically loaded, but xsetwacom list didn't show any device. Stylus input shows no response (LED on the pad still lights up; also the pad works fine in macOS with manufacturer's drivers so hardware is fine).

/t/u/digimend-kernel-drivers-parblo_A640 # modprobe -r hid-kye hid-uclogic hid-polostar hid-viewsonic
/t/u/digimend-kernel-drivers-parblo_A640 # dmesg | tail -n 10
[42484.024742] input: UC-Logic A640 System Control as /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.2/0003:5543:0061.001D/input/input66
[42484.025026] hid-generic 0003:5543:0061.001D: input,hidraw7: USB HID v1.11 Keyboard [UC-Logic A640] on usb-0000:00:14.0-1/input2
[42484.025108] usbcore: registered new interface driver usbhid
[42484.025109] usbhid: USB HID core driver
[42484.125313] input: UC-Logic A640 Pen as /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/0003:5543:0061.001B/input/input67
[42484.125653] uclogic 0003:5543:0061.001B: input,hidraw5: USB HID v1.11 Device [UC-Logic A640] on usb-0000:00:14.0-1/input0
[42484.213206] uclogic 0003:5543:0061.001C: interface is invalid, ignoring
[42484.392546] input: UC-Logic A640 Pen as /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.2/0003:5543:0061.001D/input/input68
[42484.392662] uclogic 0003:5543:0061.001D: input,hidraw6: USB HID v1.11 Device [UC-Logic A640] on usb-0000:00:14.0-1/input2
[42484.464666] uclogic 0003:5543:0061.001C: interface is invalid, ignoring
/t/u/digimend-kernel-drivers-parblo_A640 # xsetwacom list
/t/u/digimend-kernel-drivers-parblo_A640 # lsmod | grep logic
hid_uclogic            40960  0
usbhid                 65536  1 hid_uclogic
hid                   147456  5 usbhid,hid_apple,hid_uclogic,hid_generic,hid_appleir
usbcore               315392  9 xhci_hcd,ehci_pci,usbhid,hid_uclogic,bcm5974,uvcvideo,ehci_hcd,btusb,xhci_pci
/t/u/digimend-kernel-drivers-parblo_A640 # cat /sys/module/hid_uclogic/version
10

# echo "watching the uevents mentioned in dmesg while pressing pad buttons and moving stylus on the pad surface
# watch xxd -a -c 12 /sys//devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/0003:5543:0061.001B/input/input67/uevent
# watch xdd -a -c 12 /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/0003:5543:0061.001B/input/input67/uevent

@Delhi-Babu
Copy link

Delhi-Babu commented May 22, 2020

@hyiltiz can you please unloaded any configuration i.e made by you (including your wacom configuration)and with only digimend and try again once

because the tablet works fine for me

and make sure your tablet dosen't use any wacom driver

@Delhi-Babu
Copy link

Delhi-Babu commented May 22, 2020

maybe try this
digimend-kernel-drivers.zip
make sure that you didn't have any wacom setting including
/etc/X11/xorg.conf.d/50-tablet.conf and
/etc/X11/xorg.conf.d/50-tablet-dynamic.conf
and any udev rules as specified by you in udev/rules.d folder and make sure you reboot
incase this is my Xorg.log if it needs

[   726.366] (II) config/udev: Adding input device UC-Logic A640 Pen (/dev/input/mouse2)
[   726.409] (II) No input driver specified, ignoring this device.
[   726.409] (II) This device may have been added with another device file.
[   726.410] (II) config/udev: Adding input device UC-Logic A640 Pen (/dev/input/mouse1)
[   726.411] (II) No input driver specified, ignoring this device.
[   726.411] (II) This device may have been added with another device file.
[   726.553] (II) config/udev: Adding input device UC-Logic A640 Pen (/dev/input/event13)
[   726.553] (**) UC-Logic A640 Pen: Applying InputClass "libinput tablet catchall"
[   726.591] (II) Using input driver 'libinput' for 'UC-Logic A640 Pen'
[   726.617] (**) UC-Logic A640 Pen: always reports core events
[   726.617] (**) Option "Device" "/dev/input/event13"
[   726.617] (**) Option "_source" "server/udev"
[   726.737] (II) event13 - UC-Logic A640 Pen: is tagged by udev as: Tablet
[   726.871] (II) event13 - UC-Logic A640 Pen: tablet 'UC-Logic A640 Pen' unknown to libwacom
[   726.871] (II) event13 - UC-Logic A640 Pen: device is a tablet
[   726.872] (II) event13 - UC-Logic A640 Pen: device removed
[   726.966] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.2/0003:5543:0061.0003/input/input21/event13"
[   726.966] (II) XINPUT: Adding extended input device "UC-Logic A640 Pen" (type: TABLET, id 12)
[   727.027] (II) event13 - UC-Logic A640 Pen: is tagged by udev as: Tablet
[   727.028] (II) event13 - UC-Logic A640 Pen: tablet 'UC-Logic A640 Pen' unknown to libwacom
[   727.028] (II) event13 - UC-Logic A640 Pen: device is a tablet
[   727.031] (II) config/udev: Adding input device UC-Logic A640 Pen (/dev/input/event12)
[   727.031] (**) UC-Logic A640 Pen: Applying InputClass "libinput tablet catchall"
[   727.031] (II) Using input driver 'libinput' for 'UC-Logic A640 Pen'
[   727.031] (**) UC-Logic A640 Pen: always reports core events
[   727.031] (**) Option "Device" "/dev/input/event12"
[   727.031] (**) Option "_source" "server/udev"
[   727.090] (II) event12 - UC-Logic A640 Pen: is tagged by udev as: Tablet
[   727.092] (II) event12 - UC-Logic A640 Pen: tablet 'UC-Logic A640 Pen' unknown to libwacom
[   727.092] (II) event12 - UC-Logic A640 Pen: device is a tablet
[   727.092] (II) event12 - UC-Logic A640 Pen: device removed
[   727.150] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:5543:0061.0001/input/input20/event12"
[   727.151] (II) XINPUT: Adding extended input device "UC-Logic A640 Pen" (type: TABLET, id 13)
[   727.210] (II) event12 - UC-Logic A640 Pen: is tagged by udev as: Tablet
[   727.212] (II) event12 - UC-Logic A640 Pen: tablet 'UC-Logic A640 Pen' unknown to libwacom
[   727.212] (II) event12 - UC-Logic A640 Pen: device is a tablet

and my dmesg

[  723.777797] usb 1-1.2: new full-speed USB device number 3 using ehci-pci
[  723.876012] usb 1-1.2: New USB device found, idVendor=5543, idProduct=0061, bcdDevice= 0.00
[  723.876018] usb 1-1.2: New USB device strings: Mfr=5, Product=6, SerialNumber=0
[  723.876020] usb 1-1.2: Product: A640
[  723.876023] usb 1-1.2: Manufacturer: UC-Logic
[  724.810948] hid: raw HID events driver (C) Jiri Kosina
[  724.849849] usbcore: registered new interface driver usbhid
[  724.849852] usbhid: USB HID core driver
[  724.939514] input: UC-Logic A640 as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:5543:0061.0001/input/input13
[  724.940245] input: UC-Logic A640 Mouse as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:5543:0061.0001/input/input14
[  724.942010] hid-generic 0003:5543:0061.0001: input,hiddev0,hidraw0: USB HID v1.11 Mouse [UC-Logic A640] on usb-0000:00:1a.0-1.2/input0
[  724.942796] input: UC-Logic A640 Mouse as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.1/0003:5543:0061.0002/input/input15
[  724.943509] input: UC-Logic A640 as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.1/0003:5543:0061.0002/input/input16
[  724.944429] hid-generic 0003:5543:0061.0002: input,hiddev1,hidraw1: USB HID v1.11 Mouse [UC-Logic A640] on usb-0000:00:1a.0-1.2/input1
[  724.945350] input: UC-Logic A640 Keyboard as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.2/0003:5543:0061.0003/input/input17
[  725.001910] input: UC-Logic A640 Consumer Control as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.2/0003:5543:0061.0003/input/input18
[  725.002467] input: UC-Logic A640 System Control as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.2/0003:5543:0061.0003/input/input19
[  725.003045] hid-generic 0003:5543:0061.0003: input,hidraw2: USB HID v1.11 Keyboard [UC-Logic A640] on usb-0000:00:1a.0-1.2/input2
[  725.206436] input: UC-Logic A640 Pen as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:5543:0061.0001/input/input20
[  725.207300] uclogic 0003:5543:0061.0001: input,hidraw0: USB HID v1.11 Device [UC-Logic A640] on usb-0000:00:1a.0-1.2/input0
[  725.324822] uclogic 0003:5543:0061.0002: interface is invalid, ignoring
[  725.525450] input: UC-Logic A640 Pen as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.2/0003:5543:0061.0003/input/input21
[  725.525676] uclogic 0003:5543:0061.0003: input,hidraw1: USB HID v1.11 Device [UC-Logic A640] on usb-0000:00:1a.0-1.2/input2
[  725.846977] uclogic 0003:5543:0061.0002: interface is invalid, ignoring

@Delhi-Babu
Copy link

Delhi-Babu commented May 22, 2020

@spbnick I find the reason that this PR is not working
the original report descriptor for the interface 0 is

0x06, 0x07, 0xFF,   /*  Usage Page (FF07h),                             */
0x08,               /*  Usage (00h),                                    */
0xA1, 0x01,         /*  Collection (Application),                       */
0x85, 0x08,         /*      Report ID (8),                              */
0x09, 0x20,         /*      Usage (20h),                                */
0xA0,               /*      Collection (Physical),                      */
0x09, 0x42,         /*          Usage (42h),                            */
0x09, 0x44,         /*          Usage (44h),                            */
0x09, 0x45,         /*          Usage (45h),                            */
0x09, 0x3C,         /*          Usage (3Ch),                            */
0x09, 0x43,         /*          Usage (43h),                            */
0x09, 0x44,         /*          Usage (44h),                            */

and the modified version
which is

0x05, 0x0D,         /*  Usage Page (Digitizer),                         */
0x09, 0x02,         /*  Usage (Pen),                                    */
0xA1, 0x01,         /*  Collection (Application),                       */
0x85, 0x07,         /*      Report ID (7),                              */
0x09, 0x20,         /*      Usage (Stylus),                             */
0xA0,               /*      Collection (Physical),                      */
0x09, 0x42,         /*          Usage (Tip Switch),                     */
0x09, 0x44,         /*          Usage (Barrel Switch),                  */
0x09, 0x45,         /*          Usage (Eraser),                         */
0x09, 0x3C,         /*          Usage (Invert),                         */
0x09, 0x43,         /*          Usage (Secondary Tip Switch),           */
0x09, 0x44,         /*          Usage (Barrel Switch),                  */
0x14,               /*          Logical Minimum (0),                    */
0x25, 0x01,         /*          Logical Maximum (1),                    */

in short the original descriptor has report id 7 which has everything needed had usage page as
Usage Page (FF07h) and Usage (00h)
if we modified those two with Usage Page (Digitizer) and Usage (Pen) the tablet works fine
P.S I may be wrong and Correct me if I am

@hyiltiz
Copy link

hyiltiz commented May 22, 2020

maybe try this
digimend-kernel-drivers.zip

How is this .zip different from the previous one I tried? I'll unload my xorg and udev configs, reboot and try one out, but not sure which one is the most recent one at this point.

@Delhi-Babu
Copy link

Delhi-Babu commented May 22, 2020

maybe try this
digimend-kernel-drivers.zip

How is this .zip different from the previous one I tried? I'll unload my xorg and udev configs, reboot and try one out, but not sure which one is the most recent one at this point.

In the previous one I deleted some of the things in the report descriptor that I thought that they were useless (To keep it neet ) but this .zip contains full form of the report descriptor with some minor changes

and I have tried both in a lubuntu vm and pressure is working

@hyiltiz
Copy link

hyiltiz commented May 22, 2020

Tested out digimend-kernel-drivers.zip and it works! The pressure is working, and it still works after a replug. None of Krita, MyPaint or Konsole crashes when using the pen. However:

  • only the button closer to the pen tip is working (as space, would hold-drag canvas in Krita);
  • KDE System Settings detects no input tablets to be configured
  • xsetwacom list shows nothing (as expected since now it is handled by libinput

It would resolve #385 and #383.

Question: it doesn't seem to work with the X11 libwacom driver, which is probably why it is not listed in KDE System Settings / Input / Tablets. Is that not possible? Can we have built-in support for the other pen button further away from the pen tip? It is crucial for creating in Krita. We can just map it to Mouse Button 3 (RMB).

My steps

Built and installed via dkms, removed my xorg configurations (just found that I had disabled udev rules weeks ago), refreshed udev rules and killed xorg.

@Delhi-Babu
Copy link

Delhi-Babu commented May 23, 2020

@hyiltiz The tablet can use libwacom with out any issue atleast in my laptop
how to
edit this file
/etc/X11/xorg.conf.d/50-tablet.conf
with

Section "InputClass"
    Identifier "Tablet"
    Driver "wacom"
    MatchDevicePath "/dev/input/event*"
    MatchUSBID "5543:0061"
EndSection

and reboot followed by that edit successfully makes the tablet to use libwacom

TO DO's
make the upper button work
and make the frame button work
to clean up the report descriptors

@Delhi-Babu
Copy link

Delhi-Babu commented May 23, 2020

@hyiltiz added patch for upper button (button far away from the tip )
digimend-kernel-drivers.zip
kindly check that out
and I am not sure that we can alter the button functions atleast I am not sure
check that too If you know how please tell me about it

@hyiltiz
Copy link

hyiltiz commented May 23, 2020

Installed the above .zip but not the libwacom xorg.conf file. Pressure works but via libinput. We should include that snippet in the xorg.conf to be copied over into /usr/share/X11/xorg.conf.d/.

Once installed that snippet into /etc/X11/..., it is found by libwacom:

# xsetwacom list
UC-Logic A640 Mouse touch               id: 10  type: TOUCH
UC-Logic A640 Pen stylus                id: 11  type: STYLUS
UC-Logic A640 Pen eraser                id: 12  type: ERASER
UC-Logic A640 Mouse touch               id: 13  type: TOUCH
UC-Logic A640 Pen stylus                id: 23  type: STYLUS
UC-Logic A640 Pen eraser                id: 24  type: ERASER

I'd try simply adding a line in the xorg.conf file to map the upper button to the RMB, but since there are multiple entries registered by libwacom (like 2 stylus, 2 touch and 2 eraser and 0 keyboard/pad), it may just get unnecessarily tricky. It would be much easier if only a stylus and a keyboard / pad device is exported.

@Delhi-Babu
Copy link

Delhi-Babu commented May 24, 2020

digimend-kernel-drivers.zip
hey @hyiltiz I managed to get one pen and frame buttons with knowledge as far as I know
and (I think the pen buttons were configurable, tell me how)
but in the case of frame buttons I cant get it working I think @spbnick can help us in this
what is the issue in this
I can't get libwacom to handle the keyboard events until now only pen is handled by the libwacom
idk it may be because of the report id's because this tablet uses report id 3 where as most other tablets use 6 and
it may be due to the wacom device which shares the same product id didn't have any keys

anyways @spbnick need guidence here

@spbnick watched your ugee ex07 video on yt
should I emulate same like digitizer or wacom driver dosent need it anymore
ie. to make frame buttons work should I emulate pad as digitizer buttons
thanks in advance

@hyiltiz
Copy link

hyiltiz commented May 24, 2020

With my custom udev rules #383, I was able to only export the pen and pad. I then specified the device using device path for libwacom in xorg.conf (also shown there). Pad was recognized as a keyboard device. If the pad is recognized as a keyboard device, we can map it using xsetwacom. Mapping pen is the same.

@Delhi-Babu
Copy link

Delhi-Babu commented May 24, 2020

is your xsetwacom recognise pad as keyboard
cause mine detects only pen
and ignores the pad or keyboard

@hyiltiz
Copy link

hyiltiz commented May 24, 2020

It did without digimend through usbhid hid_generic and libwacom. With this new digimend patch, it doesn't; instead it recognizes 2 stylus, 2 eraser (no hardware for it though) and 2 touch (no hardware). I really hope digimend only exports the stylus and the pad.

@Delhi-Babu
Copy link

@hyiltiz actually I finished the pen stuff(with both buttons remapable) and currently working on the pad and Now I realized why you are having different report string form mine actually the dumps you provided are after using uc-logic probe or somehow you initialized the tablet, you actually enabled full functionality of the tablet and just a thing did you able to map the pad buttons before you trying this PR ie #383

@hyiltiz
Copy link

hyiltiz commented May 27, 2020

I did use uc-logic probe before to post in this project. But that shouldn't change the hardware or the dumps, I hope. I know the tablet was working without digimend just based on usbhid and libwacom but had to manually write the udev rules. Even so my udev rules were too strict it didn't quite work all the time (e.g. if I plug it into another USB port).

How did you map the pen keys? Any progress on the pad buttons?

@Delhi-Babu
Copy link

Delhi-Babu commented May 27, 2020

i mapped the pen keys with using xsetwacom --set command to key a and opened kate pressed the mapped button yay
it types a

I am kindoff confused with the pad buttons tho

the pad interface is kinda like keyboard emulation by default but when using UC-Logic probe, it made pad and pen in same interface

take a look at #403

within few minutes I'll upload full patch for pen and pen buttons

and
did you able to map pad buttons with your udev rules or before trying out this pr

here is that patch
digimend-kernel-drivers.zip
and I am not sure that the keyboard will work and It wont be detected by the libwacom
this is a dirty patch so don't mind the coding style, this is still a prototype
P.S uclogic probe enables full functionality of the tablet thats why you are able to make the pressure work, I guess

@hyiltiz
Copy link

hyiltiz commented May 27, 2020

I was able to enable the lower left pad button without digimend using custom udev rules.

@Delhi-Babu
Copy link

Delhi-Babu commented May 27, 2020

make an evtest on that event and send it here
(with pressing all of the 4 buttons on the pad one by one)
and also usbhid-dump -d 5543:0061 -es
(with pressing all of the 4 buttons on the pad one by one)

  • are you able to enable and use only one button
  • are you able to remap it
  • is that event show's in xinput list or xsetwacom --list
  • if showing what is the device name pad or keyboard

@Delhi-Babu
Copy link

@hyiltiz is that tablet return original tilt values or they are junk bytes (I don't know about tilt that much)

currently there is no idea for me to make pad working i mean, it should work idk how to implement it, I am missing at somewhere

maybe it will be done if @spbnick help us or i should make one from scratch

for further things see issue #407

@hyiltiz
Copy link

hyiltiz commented Jun 11, 2020

It doesn't respond to tilt in any meaningful way. Guess "junk bytes" in your terms.

@eduard-sukharev
Copy link

Is there any progress on this?
I've downloaded the zip from #393 (comment) and added following xorg rule:

Section "InputClass"
    Identifier "Tablet"
    Driver "wacom"
    MatchDevicePath "/dev/input/event*"
    MatchUSBID "5543:0061"
EndSection

I then ran sudo make dkms_uninstall and sudo dkms_install, rebooted with device disconnected, connected the device and it works! KDE showed me notification that a graphics tablet device is connected. System Settings module for Graphics tablet setup shows it as Wacom PenStation [0061] and allows me to configure the stylus, but I can't find the way to configure the tablet buttons.
In Krita everything works, but tilt seems to be jittering and uneven, although it seem to work.

Anything I can provide you with to solve the tilt jitter and getting tablet buttons config available in UI?

@hyiltiz
Copy link

hyiltiz commented Nov 25, 2020

I can't find the way to configure the tablet buttons.

If you read carefully, the "progress" stopped when we got stylus and pressure working, but not the buttons or tilt (afaik Parblo doesn't have tilt but feel free to show us otherwise). To help, I think it is better if you start looking into /dev/input/eventX and /sys/devices/**/input/inputX/eventY/eventZ etc., and hack with the provided patch above and come up with a variant containing your own findings about buttons. Until then, this may stay on pause.

@eduard-sukharev
Copy link

@hyiltiz Thanks for update.
I've hopped through issues and PRs and found that @DONofDESTROY seem to have his own findings: he mentioned in #407 that he has butons working, but they're interfering with pen. On his #403 issue he states that he managed to remap those generic buttons. So I see some inconsistency here and want to try and track down the issue.
Regarding the tilt: these are descirptor bits that are actually present:

		0x09, 0x3D,         /*          Usage (X Tilt),                         */
		0x15, 0x81,         /*          Logical Minimum (-127),                 */
		0x25, 0x7F,         /*          Logical Maximum (127),                  */
		0x75, 0x08,         /*          Report Size (8),                        */
		0x95, 0x01,         /*          Report Count (1),                       */
		0x81, 0x02,         /*          Input (Variable),                       */
		0x09, 0x3E,         /*          Usage (Y Tilt),                         */
		0x15, 0x81,         /*          Logical Minimum (-127),                 */
		0x25, 0x7F,         /*          Logical Maximum (127),                  */
		0x81, 0x02,         /*          Input (Variable),                       */

and as noted by @DONofDESTROY he actually found a tilt on Parblo A640 (although it seem either buggy or garbage?).

Regarding the /dev/input/event* - I've managed to adopt your udev.rule to dynamically find and symlink them:

SUBSYSTEM=="input", ENV{ID_BUS}=="usb" ENV{ID_VENDOR_ID}=="5543" ENV{ID_MODEL_ID}=="0061", \
        ATTRS{name}=="* Keyboard", SYMLINK+="input/wacom-keyboard"
SUBSYSTEM=="input", ENV{ID_BUS}=="usb" ENV{ID_VENDOR_ID}=="5543" ENV{ID_MODEL_ID}=="0061", \
        ATTRS{name}=="* Pen", SYMLINK+="input/wacom-stylus"

and in xorg.conf:

Section "InputClass"
        Driver        "wacom"
        Identifier    "A640 stylus"
        Option        "Device"        "/dev/input/wacom-stylus"        # USB ONLY
        Option        "Type"          "stylus"
        MatchProduct    "Pen"
EndSection

Section "InputClass"
        Driver        "wacom"
        Identifier    "A640 pad"                                     # Tablet buttons
        Option        "Device"        "/dev/input/wacom-keyboard"        # USB ONLY
        Option        "Type"          "pad"
        MatchProduct    "Pad"
EndSection

#Section "ServerLayout"
#       Identifier    "A640 Tablet"
#       InputDevice   "A640 stylus"
#       InputDevice   "A640 pad"
#EndSection

This didn't help much with xsetwacom list devices (it still shows only STYLUS for me), but symlinks are there. in case we need them.

@eduard-sukharev
Copy link

Ok, here goes the wireshark usbpcap dump for frame buttons pressing, dumped from Windows 10.
frame_buttons.zip

I was pressing buttons in the same order as described in DIGImend tutorial, but went a bit further and tried setting up buttons mapping via DigitizerPanel utility that came with the driver. As far as I could tell the mapping software didn't communicate with the device to set it up.
I hope it helps you (and me) to debug the format and hack this thing into working solution

@Delhi-Babu
Copy link

Delhi-Babu commented Nov 30, 2020

@eduard-sukharev after you Installed your driver the pad buttons becomes keyboard -> pad buttons which is similar to mouse
i.e., either on state or off state when you are changing the button keymaps it will be assigned in the driver ie when pressing the it produces something like

left top press
001:008:000:STREAM 1590513020.311517
07 E0 02 01 04 00 00 00 00 00

left top release
001:008:000:STREAM 1590513020.483480
07 E0 02 01 00 00 00 00 00 00

left bottom press
001:008:000:STREAM 1590513022.735493
07 E0 02 01 01 00 00 00 00 00

left bottom release
001:008:000:STREAM 1590513022.903459
07 E0 02 01 00 00 00 00 00 00

right top press
001:008:000:STREAM 1590513025.539477
07 E0 02 01 08 00 00 00 00 00

right top release
001:008:000:STREAM 1590513025.695441
07 E0 02 01 00 00 00 00 00 00

right bottom press
001:008:000:STREAM 1590513026.439468
07 E0 02 01 02 00 00 00 00 00

right bottom release
001:008:000:STREAM 1590513026.627465
07 E0 02 01 00 00 00 00 00 00

so when press event is noted the driver virtually press the key assigned and release the button if the key is released

xsetwacom remap keys which is like these buttons ie either on or off state not like keyboard with key combos

It is an hacky way used by companies to make tablet work with basic functional like mouse and keyboard without driver

@eduard-sukharev
Copy link

Ok, so from what I've understood during my attempts and from what you've said:
The tablet sends Graphics tablet buttons as 1bit values on interface 2.
libinput-debug shows that device cannot be supported as tablet unless it has pen coordinates and pressure info as well.
Pen and pressure are present on interface 0.

As far as I can undersrand, we have two possible solutions:

  1. send those button values within interface 0 data (e.g. instead of that twitchy "tilt" values at the end or just plainly amend them after it)
  2. Send fake (but safe!) pen coords and pressure values so that they don't mess with actual pen movements, don't induce phantom clicks and presses, but allows libtool (and Xorg) see the device as configurable graphics tablet with buttons.

@Delhi-Babu
Copy link

Digimend is not driver for tablets it makes the kernel not to throw garbage stuff

Here is how this works

How to do this yourself

Pen (usbhid-dump before probing i.e. tablet mode without any drivers)

Coordinates

003:006:000:STREAM             1589459739.378579
09 00 DD 0E 68 04 00 00

003:006:000 It is 0th interface

Hex byte explanation
0x09 Report Id
0x00 Represent whether pen is touching the tablet, 0x00 means hovering, 0x01 means touch the tablet
0xDD 0x0E Represent the pen's location on tablet X-axis
0x68 0x04 Represent the pen's location on the tablet Y-axis
0x00 0x00 Represent the pen's pressure

Pen Buttons

003:006:000:STREAM             1589460167.591696
09 XX EA 0C B9 0D 00 00

you need to concentrate on the 2nd hex byte i.e. XX

Hex representation Meaning
0x00 Hovering
0x01 Pen touches the tablet
0x02 Lower button is pressed while hovering
0x03 Lower button is pressed while touching the tablet
0x04 Upper button is pressed while hovering
0x05 Upper button is pressed while touching the tablet

The pen stuff is on the 0 interface TLDR The interface 1 is useless

Pen (dump with drivers or after probing)

This is why @hyiltiz and @eduard-sukharev getting pen pressure working because they should have used uclogic-probe command before taking diagnostic for the tablet i.e. the tablet is working like a tablet (pen and pad), before this command it works like a mouse and keyboard

Pen cords

003:004:000:STREAM             1588198290.120660
07 80 3E 35 84 1E 00 00 00 00

003:006:000 It is 0th interface

Hex byte explanation
0x07 Report Id for the pen
0x80 0x80 represents the pen is not found in the range, 0xC0 The pen is detected in the tablet range, 0xC1 represents the pen has touched the tablet
0x3E 0x35 Represent the pen's location on tablet X-axis
0x84 0x1E Represent the pen's location on the tablet Y-axis
0x00 0x00 Represent the pen's pressure
0x00 Represents the tilt on X-axis
0x00 Represents the tilt on Y-axis

note the tilt in this tablet seems to be legit on the xsetwacom command maybe the report descriptor I wrote is wrong but this should be out of scope.

Pen buttons

Hex representation Meaning
0x80 Pen Hovering out of the tablet limit or the pen signal is lost
0xC0 Pen Hovering in tablet sensing limit
0xC1 Pen touches the tablet inside the tablet sensing limit
0xC2 Lower button is pressed while hovering inside the tablet sensing limit
0xC3 Lower button is pressed while touching the tablet inside the tablet sensing limit
0xC4 Upper button is pressed while hovering inside the tablet sensing limit
0xC5 Upper button is pressed while touching the tablet inside the tablet sensing limit

Tablet buttons (before probing or using probe)

003:006:002:STREAM             1589460336.217563
03 01 16 00 00 00 00 00

003:006:002 It is 2th interface

Hex byte explanation
0x03 Report Id for tablet
0x01 0x01 Represent both top button, 0x03 Represent both bottom button, 0x00If no button is pressed
0x16 0x16 Represent the top left button pressed, 0x19 Represent the top right button pressed, 0x2D Represent the bottom left button pressed, 0x2E Represent the bottom right button pressed
0x00 0x00 0x00 0x00 0x00 Just Junk

Tablet buttons (after probing)

003:006:000:STREAM             1607075652.840640
07 E0 02 01 04 00 00 00 00 00

003:006:000 It is 0th interface

Hex byte explanation
0x07 Report Id
0xE0 0x02 0x01 Represents that this String is from the pad buttons
0x04 0x04Represent the pad top left button, 0x01 bottom left button, 0x08 Represent the top right button, 0x02 Represent the bottom right button
0x00 0x00 0x00 0x00 0x00 Just junk

The problem is before probing both pen and pad are at seperate interface 0th and 2nd
after probing It jumps to same interface 0 and both pen and pad have same report Id 0x07 which makes hard for us to find the difference between pen and pad interface. currently when you press pad button you Cursor will jump to a specific location.

What can we do

  1. first probe pen to make the pressure to work and probe the keyboard the make it as pad
  2. ignore the interface 1
  3. we should write a function to check whether the string is from pen or pad buttons, it will be easy as we need to check whether the 2nd byte is 0xE0 then treat the string content as Pad buttons

I am writing this cause this might be helpful for other tablet users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants