zmk icon indicating copy to clipboard operation
zmk copied to clipboard

Cirque Zephyr input driver

Open petejohanson opened this issue 2 years ago • 7 comments

Draft PR for a Cirque Pinnacle ASIC driver based on the Zephyr 3.5 input subsystem.

petejohanson avatar Nov 23 '23 23:11 petejohanson

I really like the progress being made with mouse input and cirque. But do you have some public branch or something how you use this driver to get an idea how I could use it? I have something running with the "old" code where I am not happy with it because it only works when powered over USB. Thanks!

FearlessSpiff avatar Jan 05 '24 21:01 FearlessSpiff

Added the vendor-prefixes.txt file to the module structure to silence that last warning.

petejohanson avatar Jan 30 '24 19:01 petejohanson

For now I've made this a standalone Zephyr module to make this easier to test along with #2027: https://github.com/petejohanson/cirque-input-module

petejohanson avatar Feb 11 '24 20:02 petejohanson

That repo could probably use a README.md explaining how to add the external module to one's project or at least with a link to the docs.

arturo182 avatar Feb 12 '24 23:02 arturo182

Hey, I also tried this branch (or the module) with a Cirque and the I2C driver, and I wanted to share my findings. I tried using a trackpad in I2C with a Xiao ble—my code can be found here: https://github.com/aepfli/zmk-config-totem/pull/4. I am using the, but I think this is the better place to share findings.

First of all, it seems that I don't get the driver working if I use cirque,pinnacle-i2c; the build fails because #elif DT_INST_ON_BUS(0, i2c) is never resolved to true. There, for i get warnings in the build, like

[273/333] Building C object zephyr/drivers/input/CMakeFiles/drivers__input.dir/__w/zmk-config-totem/zmk-config-totem/cirque-input-module/drivers/input/input_pinnacle.c.obj
/__w/zmk-config-totem/zmk-config-totem/cirque-input-module/drivers/input/input_pinnacle.c: In function 'pinnacle_seq_read':
/__w/zmk-config-totem/zmk-config-totem/cirque-input-module/drivers/input/input_pinnacle.c:15:35: warning: unused variable 'config' [-Wunused-variable]
   15 |     const struct pinnacle_config *config = dev->config;
      |                                   ^~~~~~
/__w/zmk-config-totem/zmk-config-totem/cirque-input-module/drivers/input/input_pinnacle.c:55:1: warning: no return statement in function returning non-void [-Wreturn-type]
   55 | }
      | ^
/__w/zmk-config-totem/zmk-config-totem/cirque-input-module/drivers/input/input_pinnacle.c: In function 'pinnacle_write':
/__w/zmk-config-totem/zmk-config-totem/cirque-input-module/drivers/input/input_pinnacle.c:58:35: warning: unused variable 'config' [-Wunused-variable]
   58 |     const struct pinnacle_config *config = dev->config;
      |                                   ^~~~~~
/__w/zmk-config-totem/zmk-config-totem/cirque-input-module/drivers/input/input_pinnacle.c:95:1: warning: no return statement in function returning non-void [-Wreturn-type]
   95 | }
      | ^
/__w/zmk-config-totem/zmk-config-totem/cirque-input-module/drivers/input/input_pinnacle.c: At top level:
/__w/zmk-config-totem/zmk-config-totem/cirque-input-module/drivers/input/input_pinnacle.c:284:12: warning: 'pinnacle_init' defined but not used [-Wunused-function]
  284 | static int pinnacle_init(const struct device *dev) {
      |            ^~~~~~~~~~~~~

which makes sense as nothing is returned at all.

On the other hand, if I am using cirque,pinnacle, I get the trackpad working, but only in USB mode—I have not managed to make it work with a BLE connection so far.

This is the wrong way to communicate/ask for help, but I currently don't have Discord available, which may help others. Furthermore, I am just getting into this topic, so my knowledge and terminology might not be the best. But as this is open source, sharing findings seems to me to be the right path. If you do have pointers for me, please don't hesitate to let me know.

// EDIT: next i will try the module with hardcoded values, only able to use i2c ;)

aepfli avatar Jun 16 '24 15:06 aepfli

On the other hand, if I am using cirque,pinnacle, I get the trackpad working, but only in USB mode—I have not managed to make it work with a BLE connection so far.

This might be because you haven't refreshed the HID descriptor: https://zmk.dev/docs/features/bluetooth#refreshing-the-hid-descriptor

caksoylar avatar Jun 17 '24 18:06 caksoylar

On the other hand, if I am using cirque,pinnacle, I get the trackpad working, but only in USB mode—I have not managed to make it work with a BLE connection so far.

This might be because you haven't refreshed the HID descriptor: https://zmk.dev/docs/features/bluetooth#refreshing-the-hid-descriptor

thank you for the suggestion @caksoylar sadly also reseting everything, and reconnecting, did not help so far.

aepfli avatar Jun 20 '24 11:06 aepfli