1kc / razer-macos

Color effects manager for Razer devices for macOS. Supports High Sierra (10.13) to Monterey (12.0). Made by the community, based on openrazer.
GNU General Public License v2.0
2.29k stars 248 forks source link

Cannot find keyboard driver ANYWHERE. -_- #279

Open Glaferg opened 3 years ago

Glaferg commented 3 years ago

I am looking to create a key-specific layout for an application and I cannot comprehend how the OpenRazer driver fits in. I cannot find it, I cannot write commands to it, and I am totally confused. Can someone give me some tips on how to open it and how to write commands to it?

Glaferg commented 3 years ago

UPDATE: Does anyone know how to assign a color to one key?

dhobi commented 3 years ago

Razer-macos just takes code from the openrazer driver, changes some code to be compatible with macOS libraries and offers the functionality with a node.js addon (you could call it a small C++ bridge). It does not offer it as driver files you could write / read to like openrazer does.

A bit more background info: With openrazer you are able to open your Razer devices like files on your drive and read and write to them. An example of such a device file can look like this (RAZER_NOMMO_CHROMA): /sys/bus/hid/drivers/razeraccessory/:0X1532:0X0517.

Assigning a single color to one key is done with the matrix_custom_frame command. It takes an array of values as an input parameter. The array is a bit special as the first 3 value just contain the information to which region (row / columns) the following values should be applied to. The values itself are just color information at the end.

Glaferg commented 3 years ago

This is SUPER useful, but I still have no idea where my OpenRazer files are on MacOS. Razer Macos runs beautifully but where is the directory storing those values?

dhobi commented 3 years ago

As I said, these driver files are not accessible with razer-macos as razer-macos works differently.

In other words, there is currently no option to send naked commands to this low-level api.

Glaferg commented 3 years ago

welp frick. Any way to mod a version and force it to send per-key raw commands or mod the code to add a function to do what I want?

dhobi commented 3 years ago

If mod = code then yes, plenty. If I'd take a direction I would most probably expose a small http server api (swagger).

Glaferg commented 3 years ago

How can I get started with this modification and then possibly add a Python API that is controllable from the GUI... @dhobi

dhobi commented 3 years ago

Just to be clear here: Currently Razer macOS provides no possibility to be controlled by an external process. What I mentioned in the previous comment was the direction I'd go to make that possible with the current stack/architecture we have. If (and only if) this is done, you could control your Razer devices connected to a Mac with anything which is able to do http requests. That would also include cli programs like curl / wget.