Using new driver API

Touchpad preference was moved to Input preference. It should be displayed when touchpad device is selected.

Can you run sudo cat /dev/hidraw<id> | od -A n -v -t x1 where <id> is your touchpad?

It returns me hex code continuously (if i use touchpad).
example:

fred@fred-VivoBook-15-ASUS-Laptop-X540UAR:~$ sudo cat /dev/hidraw0 9d60 | od -A n -v -t x1
[sudo] Mot de passe de fred :

04 03 50 04 79 04 dc 64 01 00 10 54 00 00 04 03
50 04 79 04 fa 64 01 00 10 54 00 00 04 03 50 04
79 04 36 65 01 00 10 54 00 00 04 03 50 04 79 04
7c 65 01 00 15 54 00 00 04 03 50 04 79 04 c2 65
01 00 1c 54 00 00 04 03 50 04 79 04 fe 65 01 00
24 54 00 00 04 03 50 04 79 04 44 66 01 00 24 54
00 00 04 03 5e 04 75 04 8a 66 01 00 26 54 00 00
04 03 61 04 76 04 d0 66 01 00 28 55 00 00 04 03
66 04 77 04 20 67 01 00 28 55 00 00 04 03 6b 04
78 04 5c 67 01 00 28 55 00 00 04 03 71 04 7a 04
a2 67 01 00 28 55 00 00 04 03 77 04 7b 04 e8 67
01 00 28 55 00 00 04 03 7d 04 7c 04 2e 68 01 00
2a 55 00 00 04 03 83 04 7c 04 7e 68 01 00 2a 55

Thank you for persevering

EDIT :

I identified the touchpad with:

fred @ fred-VivoBook-15-ASUS-Laptop-X540UAR: ~ $ xinput list | grep point
⎡ Virtual core pointer id = 2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id = 4 [slave pointer (2)]
⎜ ↳ ELAN1200: 00 04F3: 3067 Touchpad id = 12 [slave pointer (2)]
fred @ fred-VivoBook-15-ASUS-Laptop-X540UAR: ~ $

id haiku = 9d60
ubuntu id = 12

I tried the 2 IDs and I get the same result.

I found reason why HID descriptor reading is not working in my case, here address of pointer to command buffer is passed instead of pointer, “&” is not needed. Some garbage was passed as command. Now it is working:

> make run
objects.x86_64-cc8-release/i2c-test
1e 00 00 01 31 02 02 00 03 00 43 00 04 00 ff 00 
05 00 06 00 f3 04 c5 25 12 10 00 00 00 00 

syslog with additional debug output:

KERN: pch_i2c: CALLED status_t acquire_bus(i2c_bus_cookie)
KERN: pch_i2c: CALLED status_t exec_command(i2c_bus_cookie, i2c_op, i2c_addr, const void*, size_t, void*, size_t)
KERN: pch_i2c: exec_command: acquired busy flag
KERN: pch_i2c: exec_command: write slave address
KERN: pch_i2c: exec_command: write command buffer
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: txFlr: 0
KERN: pch_i2c: write cmd: 0x01
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: exec_command: processing buffer 30 bytes
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: txFlr: 0
KERN: pch_i2c: write cmd: 0x00 + READ, RESTART
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: Last message repeated 2 times.
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: Last message repeated 2 times.
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: Last message repeated 2 times.
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: Last message repeated 2 times.
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: Last message repeated 2 times.
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: Last message repeated 2 times.
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
KERN: Last message repeated 2 times.
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: write cmd: 0x00 + READ
Last message repeated 1 time
KERN: pch_i2c: write cmd: 0x00 + READ, STOP
KERN: pch_i2c: pch_i2c_interrupt_handler: TX_EMPTY
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: rxFlr: 30
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x1e
KERN: pch_i2c: read cmd: 0x00
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x00
KERN: pch_i2c: read cmd: 0x01
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x31
KERN: pch_i2c: read cmd: 0x02
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x02
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x00
KERN: pch_i2c: read cmd: 0x03
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x00
KERN: pch_i2c: read cmd: 0x43
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x00
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x04
KERN: pch_i2c: read cmd: 0x00
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0xff
KERN: pch_i2c: read cmd: 0x00
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x05
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x00
KERN: pch_i2c: read cmd: 0x06
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x00
KERN: pch_i2c: read cmd: 0xf3
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x04
KERN: pch_i2c: read cmd: 0xc5
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x25
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x12
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x10
KERN: pch_i2c: read cmd: 0x00
KERN: pch_i2c: pch_i2c_interrupt_handler: RX_FULL
KERN: pch_i2c: read cmd: 0x00
KERN: Last message repeated 2 times.
KERN: pch_i2c: pch_i2c_interrupt_handler: 
KERN: pch_i2c: exec_command: processing done
KERN: pch_i2c: CALLED void release_bus(i2c_bus_cookie)

Well, that shouldn’t have been easy to find !!!
and the fix is integrated in a update?

Not yet. This bug is present only when accessing I2C bus from userland, i2c_hid should be not affected.

No problem, I still have my ps2 mouse.
Thank you

I managed to get pen input packets on my tablet:

0a 00 02 21 97 43 2f 32 d1 04 
0a 00 02 21 45 41 df 30 18 06 
0a 00 02 21 0a 43 3f 2d d7 06 
0a 00 02 21 56 47 16 2b 80 07 
0a 00 02 21 4f 49 68 2d 91 07 
0a 00 02 21 80 47 49 30 c5 04 
0a 00 02 20 d5 44 23 30 00 00 
0a 00 02 20 a4 43 87 2f 00 00 
0a 00 02 20 97 43 84 2f 00 00 
0a 00 02 20 8c 43 82 2f 00 00 
0a 00 02 20 82 43 80 2f 00 00 
0a 00 02 00 82 43 80 2f 00 00 
0a 00 02 00 82 43 80 2f 00 00 
0a 00 02 00 82 43 80 2f 00 00 

last 3 int16 values are x, y and pressure.

6 Likes

I created input_server device addon that use i2c_raw device and I managed to make pen working on Haiku:
CIMG4636
Currently driver use hardcoded packet layout and ignore HID report descriptor.

34 Likes

wow… great… thanks for your hardwork… i’m not yet have any of pen device… but i have plan to buy it…

Most work is done by Korli, I did testing, bug fixing and adopting for my hardware. Proper HID implementation is not yet done. There should be common HID interface provided by USB, I2C and Bluetooth HID devices.

2 Likes

…oh ok so thanks to you both @korli and you

I never thought I’d say something like that, but OMG!

Do you still have this package somewhere?

I think it is in his “HaikuUtils” repository. But he noted in that message:

So we really just need to finish the real driver.

That package contains binaries of i2c and i2c_hid drivers made by @korli. Now i2c driver is merged, but i2c_hid is not (https://review.haiku-os.org/c/haiku/+/2466). I can create package again if needed.

This is a different thing (HaikuUtils/I2cTabletDevice at master · X547/HaikuUtils · GitHub). It need adjustments to be used with different hardware.

I have two questions about this i2c driver being merged:

  1. does this mean that it is available in nightly builds?
  2. does any of the work that was done for this tablet input apply to touchpads like those on laptops (i.e. the trackpad)?

I have a Lenovo laptop that has the touchpad/trackpad on the i2c bus and I’m wondering if this change would either apply to that, or make it so that the current trackpad support in Haiku would now work if the device is connected on the i2c bus rather than PS2 or USB.

The driver for i2c tablets/touchpads is work in progress here: https://review.haiku-os.org/c/haiku/+/2466

As you can see in this version, the whole HID parser was copied from the USB driver. It should instead be refactored, maybe the USB and I2C drivers should expose an HID bus and then a generic HID driver would handle devices on that bus. Or maybe we can keep the drivers as they are now, and just make the HID code a separate kernel module loaded by them. But in any case, we would prefer to not copypaste the same code in two drivers. At a bare minimum it could be made into a static lib for both drivers to link into, I guess?

Help welcome refactoring this!

1 Like

damn, I have such a touchpad :joy: and it does not work in Haiku
but I don’t know what to say to the mouse, - there you probably need to unscrew the leg that sends a signal to turn off the power, the neighbor woodpecker got sick. but I haven’t figured out the legs yet)

1 Like