-
Notifications
You must be signed in to change notification settings - Fork 30
Using the mouse driver
Inside the folder of the device binded to the driver there will be some of the following files (some should disappear if they are not supported by the mouse when we get multi-mouse support). For all the example commands shown you need to be root to run them.
The Up DPI and Down DPI buttons don't actually do anything, the Synapse actually changes the DPI for you. Am investigating the whole point of storing 5 DPI values in the mouse when you can just change them arbitrarily.
This file doesn't accept being written to but when it is read it will output a string identifying the type of device it is. I thought using this would be easier than remembering the USB vender/product IDs.
Example command
$ cat device_type
Razer Mamba
This is a complicated one. Breathing mode has 3 modes of operation. Mode 1 fading in and out using a single colour. Mode 2 is fading in and out between two colours. Finally mode 3 is fading in and out between random colours (there's a pattern, its not random ;) ).
If 1 byte is written to it, random mode will be activated. (Technically any number of bytes as long as its not 3 or 6).
If 3 bytes are written to it, single colour mode will be activated and the 3 bytes will be interpreted as RGB.
If 6 bytes are written to it, dual colour mode will be activated and the 3 bytes will be interpreted as RGB colour 1 and the last 3 bytes will be RGB colour 2.
Example commands
$ echo -n "1" > mode_breath # Random Mode
$ echo -n -e "\xFF\x00\x00" > mode_breath # Single mode (red)
$ echo -n -e "\xFF\x00\x00\x00\x00\xFF" > mode_breath # Dual mode (red & blue)
Activates custom mode on the mouse, when the colours have been set it activates them.
This is normally called after writing to set_key_row
Example command
$ echo -n "1" > mode_custom
This sets the Chroma to no effect mode. This file doesn't care what is written to it, just that something is written.
Example command:
$ echo -n "1" > mode_none
This sets the mouse and dock into the reactive effect mode where it will illuminate for a period of time when mouse is clicked.
This file accepts 1 byte which denoted the speed. Must be in the range of 1-3, 1 being short, 3 being long. Then 3 bytes meaning RGB.
Example commands
$ echo -n -e "\x01\x00\xFF\xFF" > mode_reactive
$ echo -n -e "\x03\xFF\x00\xFF" > mode_reactive
First commands is reactive mode where the keys don't illuminate for that long with a cyan colour. The second is purple with the longest illumination time.
This mode the mouse will cycle though the colour spectrum. Doesn't care what's written to it.
Example command
$ echo -n "1" > mode_spectrum
This mode the mouse and dock shows a single colour. It accepts 3 bytes representing RGB.
Example command
$ echo -n -e "\xFF\x00\xFF" > mode_static
This mode sends colour waves across the mouse and dock. It accepts either 1 or 2 representing the direction of the wave Up or Down.
Example commands
$ echo -n "1" > mode_wave
$ echo -n "2" > mode_wave
This accepts integers from 0-255.
Example commands
$ echo -n "0" > set_wireless_brightness
$ echo -n "255" > set_wireless_brightness
This command sets the LED segments of the mouse. It accepts 15 RGB values. I haven't mapped the position of the RGB to the mouse LEDs but I believe it goes down the left side, up the right side then ending on the middle mouse wheel LED.
Example command
scripts/razer_mouse/driver/custom_effect.py
This creates a string of 15 random rgb colours and sets the mouse to that, then loops and does that a few times.
Gets the serial number from the device, usually 2 numbers then 13 digits in my experience.
Example command
$ cat get_serial
XX1111111111111
Gets the battery percentage. It will be scaled from 0-255 so you'll have to divide by 255 and then multiply by 100.
Example command
$ cat get_battery
128
As the battery percentage is 128
, (128/255)*100≈50
If it outputs 1 then the device is charging, if its 0 then the device is not charging. Useful to display charging symbol.
Example command
$ cat is_charging
1
This file accepts an RGB value (3 bytes) to set the charging colour
Example command
$ echo -n -e "\xFF\x00\xFF" > set_charging_colour
This sets charging colour to purple
This file accepts either 0x00 (use current mouse effect) or 0x01 (use the charge colour set by set_charging_colour
).
Example command
$ echo -n -e "\x01" > set_charging_effect
This sets mouse to use the colour defined by set_charging_colour
This file accepts the number of seconds written in ASCII. Currently the kernel driver limits you to a max of 15 minutes (900secs) as this is the max in the windows driver.
Example command
$ echo -n -e "120" > set_idle_time
This means the mouse will turn off after 2 minutes of inactivity.
set_low_battery_threshold - Sets the battery percentage before the mouse flashes due to low battery (Write only)
This file accepts an ASCII number of a battery percentage to set the threshold at. The number you must write needs to be 100 scaled to 0->255. It's been capped at a max of 25% as this is the same as the windows driver. God the mouse is super annoying when it starts flashing. Although you could set it as low as 1%, I would recommend 10%.
Example command
$ echo -n -e "\x0C" > set_low_battery_threshold
This means the mouse will flash when the battery is lower than 5%. (5/100)*255=12.75≈0x0C
This file sets the DPI in the X and Y direction (yes they can be different, its ridiculous). This file accepts 2 or 4 bytes, aka 2 unsigned shorts in big-endian format (byte 0 is the high order). See the python file provided.
Example command
$ scripts/razer_mouse/driver/set_mouse_dpi.py