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

Can't use with karabiner-Element 11.4.0 #7

Closed
fz68 opened this issue Dec 22, 2017 · 4 comments
Closed

Can't use with karabiner-Element 11.4.0 #7

fz68 opened this issue Dec 22, 2017 · 4 comments

Comments

@fz68
Copy link

fz68 commented Dec 22, 2017

Mac Book Pro 2012 later with High Sierra 10.13.1

sudo setleds -v result:

    SetLEDs version 0.2 - http://github.com/damieng/setledsmac

     "Apple Internal Keyboard / Trackpad" ?num ?caps ?scroll

    Some state could not be determined. Please try running as root/sudo.`
@damieng
Copy link
Owner

damieng commented Dec 22, 2017

This would appear to be an issue with Karabiner. They are interfering with the built in keyboard device but implementing an incomplete API that subsequently prevents getting the keyboard state using the IOKit apis.

Specifically this api call https://github.com/damieng/setledsmac/blob/master/Source/SetLEDs/main.c#L116 always returns zero when attempting to obtain the pointer to the integer LED value.

I did notice that their driver at https://github.com/tekezo/Karabiner-Elements/blob/f3ddb6ec45e6ded9d9ed05b968bc70990b91f06f/src/vendor/Karabiner-VirtualHIDDevice/src/VirtualHIDKeyboard/VirtualHIDKeyboard.cpp does not support the kHIDPage_LEDs usage page which would explain why we can't get the keyboard state from that although I'm not sure what they're doing that interferes with the internal Apple keyboard (replacing the driver or hooking it?)

@rodolfo-gonzalez
Copy link

rodolfo-gonzalez commented Mar 24, 2018

There is a way to use setleds and Karabiner-Elements, basically is to close Karabiner-Elements set leds ON with setleds and then open Karabiner-Elements it worked for me disabling Manipulate LED under Devices in Karabiner-Elements

here is a small fish function i wrote:

function masterkeys-pro-led
    set setleds_cmd "$HOME/.dotfiles/setleds"
    set karabiner "Karabiner-Elements"
    set masterkeys "MASTERKEYS PRO S"

    if eval $setleds_cmd -v | grep "$masterkeys" > /dev/null
        if pgrep -i "karabiner"
            sudo kill (pgrep -i "karabiner")
        end
        eval $setleds_cmd -v -name '$masterkeys' +scroll +caps
        open -a $karabiner
    end
end

@manolodeinternet
Copy link

Hi @rodolfo-gonzalez , what a great solution !!!

I'm newby at keyboard programing. Would you be so kind of sharing with us how do you implement the 'function master keys-pro-led' ? Because I can't tell if that code must be compiled through Xcode or a batch terminal file. Can you give us a short description of the process or a tip, please ?

Thanks in advance for taking the time to read my question.
Regards !!!

NOTE: (Using your code will be great for me, because I'm spending weeks looking though Internet for a solution for controlling LEDs lights on my old IBM M '89 with my Mac. I'm trying right now with ControllerMate, but I found the same problem. Karabiner VirtualHIDKeyboard interferes with ControllerMate too.)

@rodolfo-gonzalez
Copy link

@xcode-manolo that is a small fish function you will have to either use https://fishshell.com/ or translate that function to a bash script.

What the function does is:

  • check if karabiner elements is up then kill it
  • set your keyboard leds on with setleds command
  • open karabiner elements app

this is the only way i could make the work, is very important that you close karabiner elements before using setleds once you have turned on all leds, you can use karabiner as normal

cheers.

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

No branches or pull requests

4 participants