Skip to content

A working libusb userspace driver for the Logitech G13

License

Notifications You must be signed in to change notification settings

brittyazel/g13d

Repository files navigation

Userspace driver for the G13

Installation

Make sure you have log4cpp, libevdev and libusb-1.0 installed.

For Archlinux

Install g13-git from AUR

Building from source

$ cd <sourcedir>
$ cmake -B build -S .
$ cd build
$ make

OLD DOCUMENTATION FOLLOWS

Build

Compile by running

make

If you want to Run the daemon as user, put the file 91-g13.rules into /etc/udev/rules.d/ (or whatever directory your distribution uses).

Running

Connect your device, then Run ./g13d, it should automatically find your device.

If you see output like

Known keys on G13:
BD DOWN G1 G10 G11 G12 G13 G14 G15 G16 G17 G18 G19 G2 G20 G21 G22 G3 G4 G5 G6 G7
 G8 G9 L1 L2 L3 L4 LEFT LIGHT LIGHT2 LIGHT_STATE M1 M2 M3 MISC_TOGGLE MR TOP UND
EF1 UNDEF3 
Known keys to map to:
0 1 2 3 4 5 6 7 8 9 A APOSTROPHE B BACKSLASH BACKSPACE C CAPSLOCK COMMA D DELETE
 DOT DOWN E END ENTER EQUAL ESC F F1 F10 F11 F12 F2 F3 F4 F5 F6 F7 F8 F9 G GRAVE
  H HOME I INSERT J K KP0 KP1 KP2 KP3 KP4 KP5 KP6 KP7 KP8 KP9 KPASTERISK KPDOT K
  PMINUS KPPLUS L LEFT LEFTALT LEFTBRACE LEFTCTRL LEFTSHIFT M MINUS N NUMLOCK O 
  P PAGEDOWN PAGEUP Q R RIGHT RIGHTALT RIGHTBRACE RIGHTCTRL RIGHTSHIFT S SCROLLL
OCK SEMICOLON SLASH SPACE T TAB U UP V W X Y Z 
Found 1 G13s

Active Stick zones 
           STICK_UP   { 0 x 0.1 / 1 x 0.3 }   SEND KEYS: UP
         STICK_DOWN   { 0 x 0.7 / 1 x 0.9 }   SEND KEYS: DOWN
         STICK_LEFT   { 0 x 0 / 0.2 x 1 }   SEND KEYS: LEFT
        STICK_RIGHT   { 0.8 x 0 / 1 x 1 }   SEND KEYS: RIGHT
       STICK_PAGEUP   { 0 x 0 / 1 x 0.1 }   SEND KEYS: PAGEUP
     STICK_PAGEDOWN   { 0 x 0.9 / 1 x 1 }   SEND KEYS: PAGEDOWN

that is good. This also shows you which name the keys on the G13 have, and what keys you can bind them to.

Command line options

The following options can be used when starting g13d

Option Description
--help show help
--logo arg set logo from file
--config arg load config commands from file
--pipe_dir arg specify the root directory for input and output pipes
--umask octal specify umask for pipes creation

Configuring / Remote Control

Configuration is accomplished using the commands described in the [Commands] section.

Commands can be loaded from a file specified by the --config option on the command line.

Commands can be also be sent to the command input pipe, which is at /run/g13d/g13-0 by default. Example:

echo rgb 0 255 0 > /run/g13d/g13-0

Actions

Various parts of configuring the G13 depend on assigning actions to occur based on something happening to the G13.

  • key, possible values shown upon startup (e.g. LEFTSHIFT). It may be prefixed with "-" to indicate a release action.
  • multiple keys, like LEFTSHIFT+F1
  • keys on release, like LEFTSHIFT+F1 LEFTSHIFT+F2
  • pipe output, by using ">" followed by text, as in >Hello - causing Hello (plus newline) to be written to the output pipe ( /run/g13d/g13-0_out by default )
  • command, by using "!" followed by text, as in !stickmode KEYS

Commands

rgb r g b

Sets the backlight color

mod n

Sets the background light of the mod-keys. n is the sum of 1 (M1), 2 (M2), 4 (M3) and 8 (MR) (i.e. 13 would set M1, M3 and MR, and unset M2).

bind keyname action

This binds a key or a stick zone.

  • The possible values of keyname for keys are shown upon startup (e.g. G1).
  • The possible values of action are described in [Actions].

stickmode mode

The stick can be used as an absolute input device or can send key events. You can change modes to one of the following:

Mode Description
KEYS translates stick movements into key / action bindings
ABSOLUTE stick becomes mouse with absolute positioning
CALCENTER calibrate stick center position
CALBOUNDS calibrate stick boundaries
CALNORTH calibrate stick north

stickzone operation zonename args

defines zones to be used when the stick is in KEYS mode

Where operation can be

operation what it does
add add a new zone named zonename
del remove zone named zonename
action set action for zone, see [Actions]
bounds set boundaries for zone, args are X1, Y1, X2, Y2, where X1/Y1 are top left corner, X2/Y2 are bottom right corner

Default created zones are STICK_LEFT, STICK_RIGHT, STICK_UP, and STICK_DOWN.

Zone boundary coordinates are based on a floating point value from 0.0 (top/left) to 1.0 (bottom/right), which is upside down to the user. When the stick enters the boundary area, the zone's action down activity will be fired. On exiting the boundary, the action up activity will be fired.

Example:

stickzone add TheBottomLeft
stickzone bounds TheBottomLeft 0.0 0.9 0.1 1.0
stickzone action TheBottomLeft END

delete key|zone|profile glob-pattern

Deletes the objects whose names match the given glob-pattern.

Examples:

delete zone STICK_PAGE*
delete profile WoW
delete key M[1-3]

pos row col

Sets the current text position to row col.

  • row is specified in characters (0-4), as all fonts are 8 pixels high and rows start on pixel row 0, 8, 16, 24, or 32
  • col is specified in pixels (0-159)

out text

Writes text to the screen at the current text position, and advances the current position based on the font size

clear

Clears the screen

textmode mode

Sets the text mode to mode, current options are 0 (normal) or 1 (inverted)

refresh

Resends the screen buffer

profile profile_name

Selects profile_name to be the current profile, it if it doesn't exist creating it as a copy of the current profile.

All key binding changes (from the bind command) are made on the current profile.

font font_name

Switch font, current options are 8x8 and 5x8

dump all|current|summary

Dumps G13 configuration info to g13d console

log_level trace|debug|info|warning|error|fatal

Changes the level of detail written to the g13d console

License

All files without a copyright notice are placed in the public domain. Do with it whatever you want.

Some source code files include MIT style license - see files for specifics.

About

A working libusb userspace driver for the Logitech G13

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published