Skip to content
Daniel Hobi edited this page Mar 12, 2021 · 16 revisions

Tech stack

Overview

  • Drivers - C
  • Node native modules for calling C driver functions - Some C++
  • UI - Electron React app in Javascript

Architecture

Electron (JavaScript) -> node-addon-api (C++) -> ported openrazer drivers (C)

Driver file explanations

Ported drivers

Razer common drivers ported from Linux to macOS. Files from osx-razer-blade project:

razercommon.c	        
razercommon.h	   

Razer keyboard drivers from openrazer, function signatures translated from Linux to work with macOS:

razerkbd_driver.c	
razerkbd_driver.h	

Shared drivers

Directly imported from openrazer. They can be shared between Linux and macOS without modification.

Razer Chroma control:

razerchromacommon.h
razerchromacommon.c	

Device feature explanation

Razer Devices are being defined and configured with json files in the src/devices folder.

One example might look like:

{
    "name": "Razer Abyssus V2",
    "productId": "0x005B",
    "mainType": "mouse",
    "image": "https://assets.razerzone.com/eeimages/support/products/721/721_abyssusv2.png",
    "features": ...[more in the features subchapter]...
    "featuresMissing": ...[more in the featuresMissing subchapter]...
    "featuresConfig": ...[more in the featuresConfig subchapter]...
}

"name": Will be shown in the GUI as the device name
"productId": Used to identify the device (node-addon reports this)
"mainType": used to assign common features for this device type
"image": Shown in the configuration window

All available feature identifier strings are defined in featurehelper.js

Property: features (default: null)

If you know that your device has only a subset of all the features razer-macos provides, you can define them here. Keep in mind though that new features added by the razer-macos community won't be automatically shown. If that's not what you want, you should define "featuresMissing" instead.

"features": ["static", "oldMouseEffects", "dpi", "mouseBrightness"]

Property: featuresMissing (default: null)

If you know your device is not having a feature, you can exclude it. Keep in mind though that new features added by the razer-macos community will be automatically shown for this device as well. If that's not what you want, you should define "features" instead.

"featuresMissing": ["none", "waveSimple", "spectrum", "reactive", "breathe"]

Property: featuresConfig (default: null)

Sometimes a device has a feature but only supports part of it. This field allows to further configure a feature (if the feature allows it of course) Take the following featuresConfig of the Razer Abyssus V2 as an example:

"featuresConfig": [
    {
      "static": { // the mouse has no red color. Impacts menu & color picker
        "enabledRed": false 
      }
    },
    {
      "oldMouseEffects": { // does not have the scroll sub feature
        "enabledScroll": false 
      }
    },
    {
      "mouseBrightness": { // lacks brightness control for these LED
        "enabledLogo": false,
        "enabledLeft": false,
        "enabledRight": false
      }
    },
    {
      "dpi": { // can only go up to 5000 DPI
        "max": 5000
      }
    }
]

For a complete list of what a feature allows to configure, have a look at the corresponding feature*.js class (getDefaultConfiguration)