dnaq / plover-machine-hid

POC Plover plugin and firmware for the Plover HID protocol
MIT License
24 stars 8 forks source link

zmk commit not outputting events to xev (on nixos) #2

Closed stites closed 1 year ago

stites commented 1 year ago

Hi dnaq!

I built your fork for my ZMK device (a cornish zen) and have a keymap which looks the the following (https://github.com/stites/zmk-config/blob/main/config/corne-ish_zen.keymap#L73-L80):

        plover_layer {
            label = "PLOVER";
            bindings = <
   &none        &kp  PLV_SL  &kp PLV_TL  &kp PLV_PL  &kp PLV_HL  &kp PLV_ST        &kp PLV_ST  &kp PLV_FR  &kp PLV_PR  &kp PLV_LR  &kp PLV_TR  &kp PLV_DR
   &none        &kp  PLV_SL  &kp PLV_KL  &kp PLV_WL  &kp PLV_RL  &kp PLV_ST        &kp PLV_ST  &kp PLV_RR  &kp PLV_BR  &kp PLV_GR  &kp PLV_SR  &kp PLV_ZR
   &to  COLMAK  &kp  PLV_X1  &kp PLV_X2  &kp PLV_X3  &kp PLV_X4  &kp PLV_X5        &kp PLV_X6   &kp PLV_X7  &kp PLV_X7  &kp PLV_X8  &kp PLV_X9  &none
                                          &kp PLV_A   &kp PLV_O  &kp PLV_NM        &kp PLV_NM   &kp PLV_E   &kp PLV_U
            >;
        };

This layer is not triggering any output according to xev -- is there something I should be doing in addition to simply toggling the layer?

Because I am building a zen (which is not in the main branch of zmk) I had to cherry picked your commit over someone else's fork. Possibly this is also the problem? The branch I am working off of is here: https://github.com/stites/zmk/tree/zen-on-main+969+plover-hid

I am also using this flake for my build environment and run make clean && make to produce my firmware.

dnaq commented 1 year ago

You need to use the corresponding input plugin for plover. You shouldn’t see any output in xev, since this acts is its own protocol, not as a keyboard.

On Thu, 27 Oct 2022 at 17:57, Sam Stites @.***> wrote:

Hi dnaq!

I built your fork for my ZMK device (a cornish zen) and have a keymap which looks the the following ( https://github.com/stites/zmk-config/blob/main/config/corne-ish_zen.keymap#L73-L80 ):

    plover_layer {
        label = "PLOVER";
        bindings = <

&none &kp PLV_SL &kp PLV_TL &kp PLV_PL &kp PLV_HL &kp PLV_ST &kp PLV_ST &kp PLV_FR &kp PLV_PR &kp PLV_LR &kp PLV_TR &kp PLV_DR &none &kp PLV_SL &kp PLV_KL &kp PLV_WL &kp PLV_RL &kp PLV_ST &kp PLV_ST &kp PLV_RR &kp PLV_BR &kp PLV_GR &kp PLV_SR &kp PLV_ZR &to COLMAK &kp PLV_X1 &kp PLV_X2 &kp PLV_X3 &kp PLV_X4 &kp PLV_X5 &kp PLV_X6 &kp PLV_X7 &kp PLV_X7 &kp PLV_X8 &kp PLV_X9 &none &kp PLV_A &kp PLV_O &kp PLV_NM &kp PLV_NM &kp PLV_E &kp PLV_U

; };

This layer is not triggering any output according to xev -- is there something I should be doing in addition to simply toggling the layer?

Because I am building a zen (which is not in the main branch of zmk) I had to cherry picked your commit over someone else's fork. Possibly this is also the problem? The branch I am working off of is here: https://github.com/stites/zmk/tree/zen-on-main+969+plover-hid

I am also using this flake https://github.com/stites/zmk-config/blob/main/flake.nix for my build environment and run make clean && make to produce my firmware.

— Reply to this email directly, view it on GitHub https://github.com/dnaq/plover-machine-hid/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ5KBOCJ4B6NSXLPXVHURTWFKQ6ZANCNFSM6AAAAAARQG2DDM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

stites commented 1 year ago

ah! I need to add figure out a nix derivation for this library -- I am getting the following error:

2022-10-27 13:23:15,221 [MainThread] ERROR: error loading machine plugin: Plover HID (from plover_machine_hid)
Traceback (most recent call last):
  File "/nix/store/hbza0ighp7h8rb95sl66zh3jfvalhq2g-python3.9-plover-4.0.0.dev10/lib/python3.9/site-packages/plover/registry.py", line 56, in register_plugin_from_entrypoint
    obj = entrypoint.load()
  File "/nix/store/hhz7z49xrg1rc7j1x6h3i4f522b0jvxy-python3.9-setuptools-61.2.0/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2458, in load
    return self.resolve()
  File "/nix/store/hhz7z49xrg1rc7j1x6h3i4f522b0jvxy-python3.9-setuptools-61.2.0/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2464, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/root/.config/plover/pythonuserbase/lib/python3.9/site-packages/plover_machine_hid.py", line 17, in <module>
    import hid
  File "/root/.config/plover/pythonuserbase/lib/python3.9/site-packages/hid/__init__.py", line 30, in <module>
    raise ImportError(error)
ImportError: Unable to load any of the following libraries:libhidapi-hidraw.so libhidapi-hidraw.so.0 libhidapi-libusb.so libhidapi-libusb.so.0 libhidapi-iohidmanager.so libhidapi-io
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
2022-10-27 13:23:15,820 [Dummy-1] WARNING: Can't open serial port
Traceback (most recent call last):
  File "/nix/store/z5s75npydlzmmyxaq2amd7hxml9fwdng-python3.9-pyserial-3.5/lib/python3.9/site-packages/serial/serialposix.py", line 322, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)

Would you happen to have one already on hand or could you add it to https://github.com/dnaq/plover-flake ? I see that you have already set up hidapi here: https://github.com/dnaq/plover-flake/blob/master/default.nix#L3-L35

dnaq commented 1 year ago

I don’t have one unfortunately, but you should be able to install the plugin with plover -s plover_plugins install /path/to/git/repo using the plover-flake derivation.

You also need to make sure that your user has permissions to read the raw hid devices, on nixos it’s the uinput group I believe.

On Thu, 27 Oct 2022 at 19:25, Sam Stites @.***> wrote:

ah! I need to add figure out a nix derivation for this library. Would you happen to have one already on hand or could you add it to https://github.com/dnaq/plover-flake ?

— Reply to this email directly, view it on GitHub https://github.com/dnaq/plover-machine-hid/issues/2#issuecomment-1293844202, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ5KBJUVK7PKDU24OEHCOLWFK3KDANCNFSM6AAAAAARQG2DDM . You are receiving this because you commented.Message ID: @.***>