Author Topic: Need help with this code for Corsair K60 (on OSX)  (Read 1757 times)

0 Members and 1 Guest are viewing this topic.

Offline moazzamk

  • Thread Starter
  • Posts: 15
Need help with this code for Corsair K60 (on OSX)
« on: Sat, 08 February 2014, 21:49:04 »
Hi guys,

On OSX, the caps lock of k60 always stays on. The num lock and scroll lock keys are always off. I am trying to write a program that will toggle the LED when any of the 3 locks are pressed. So, the first thing I want to do is figure out how to turn them on or off. However, after trying for 2 weeks I don't know what to do anymore. Maybe someone here can take a look at it and get something I missed.

The code for it is here:
https://gist.github.com/moazzamk/8893951

One thing to note: I mention in the comments in my code that k60 usage for caps lock is 1 and not 2 (as specified in HID specifications) but I am not sure of that anymore.

I know very little of C (and almost nothing about object C) so the code is not organized.

Thanks in advance!




Offline spiceBar

  • Posts: 998
    • ChessTiger.com
Re: Need help with this code for Corsair K60 (on OSX)
« Reply #1 on: Sat, 08 February 2014, 22:05:01 »
Hi guys,

On OSX, the caps lock of k60 always stays on. The num lock and scroll lock keys are always off. I am trying to write a program that will toggle the LED when any of the 3 locks are pressed. So, the first thing I want to do is figure out how to turn them on or off. However, after trying for 2 weeks I don't know what to do anymore. Maybe someone here can take a look at it and get something I missed.

The code for it is here:
https://gist.github.com/moazzamk/8893951

One thing to note: I mention in the comments in my code that k60 usage for caps lock is 1 and not 2 (as specified in HID specifications) but I am not sure of that anymore.

I know very little of C (and almost nothing about object C) so the code is not organized.

Thanks in advance!

OS X should toggle the LED when you press the CapsLock key, so if the LED is always on there is probably some trick involved from the keyboard and you won't be able to do it with a program.

Maybe the keyboard does NKRO over USB, which means it presents himself as a USB hub to the computer, and when the Mac sends a LED command it does not send it to the right simulated device. I don't know, just guessing.

OS X does not use the NumLock LED, so it is normal that it stays on. For ScrollLock, I don't know.

Offline moazzamk

  • Thread Starter
  • Posts: 15
Re: Need help with this code for Corsair K60 (on OSX)
« Reply #2 on: Sat, 08 February 2014, 22:50:52 »
The num lock LED is always off. The caps lock is always on. Yeah, this is supposed to have NKRO. Thing is I run my code 3-4 times it shuts the caps lock LED off. I don't know why or how. I didn't know NKRO worked by registering the keyboard as a USB hub. That is interesting.

Offline spiceBar

  • Posts: 998
    • ChessTiger.com
Re: Need help with this code for Corsair K60 (on OSX)
« Reply #3 on: Sat, 08 February 2014, 22:58:54 »
The num lock LED is always off. The caps lock is always on. Yeah, this is supposed to have NKRO. Thing is I run my code 3-4 times it shuts the caps lock LED off. I don't know why or how. I didn't know NKRO worked by registering the keyboard as a USB hub. That is interesting.

Try your code with a simpler keyboard (any dumb membrane PC keyboard) and see if your code works better.

If so, then maybe the NKRO trick (the keyboard registering as a composite USB device) is the problem.

Offline moazzamk

  • Thread Starter
  • Posts: 15
Re: Need help with this code for Corsair K60 (on OSX)
« Reply #4 on: Sat, 08 February 2014, 23:27:03 »
Thanks for the awesomely fast replies !

After what you said, I took out my Dell dome keyboard and hooked just that to the laptop (through a USB hub) and my program works like a charm. However, if I also hook the k60 to it, none of the keyboards LEDs change state.
 
In standard mode (non-NKRO I think for BIOS compatibility) the caps lock button turns the LED on and off but my program still can't change it. So, the k60 seems like a different beast altogether. I wish I had 2 membrane keyboards so I could hook them both up and see if my program would still work.

Anyway, the whole point of me trying to write the damn thing was so I could make the LEDs on k60 light on when caps lock was on. Damn Corsair!! I love the keyboard but not the LED lol.

Another interesting thing is that when I plugged k60 into a Windows machine, it behaved the same way it did on my Mac but after 2 minutes it behaved correctly. I am guessing Windows does some device probing that makes it work? Not sure.

Offline spiceBar

  • Posts: 998
    • ChessTiger.com
Re: Need help with this code for Corsair K60 (on OSX)
« Reply #5 on: Sun, 09 February 2014, 00:14:51 »
Thanks for the awesomely fast replies !

After what you said, I took out my Dell dome keyboard and hooked just that to the laptop (through a USB hub) and my program works like a charm. However, if I also hook the k60 to it, none of the keyboards LEDs change state.
 
In standard mode (non-NKRO I think for BIOS compatibility) the caps lock button turns the LED on and off but my program still can't change it. So, the k60 seems like a different beast altogether. I wish I had 2 membrane keyboards so I could hook them both up and see if my program would still work.

Anyway, the whole point of me trying to write the damn thing was so I could make the LEDs on k60 light on when caps lock was on. Damn Corsair!! I love the keyboard but not the LED lol.

Another interesting thing is that when I plugged k60 into a Windows machine, it behaved the same way it did on my Mac but after 2 minutes it behaved correctly. I am guessing Windows does some device probing that makes it work? Not sure.

I'm wondering if it's normal behavior for the K60. Now you need input from people who own this keyboard (I don't).

Offline moazzamk

  • Thread Starter
  • Posts: 15
Re: Need help with this code for Corsair K60 (on OSX)
« Reply #6 on: Sun, 09 February 2014, 04:30:05 »
Yeah, it's a known problem on OSX with Corsair keyboards (not just k60). That's why I wanted to write something to solve it. Maybe I should try using the USB library instead of HID library.