Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Modifiers + Logging Cleanup #11

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 91-g13.rules
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SUBSYSTEM=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c21c", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c21c", MODE="0666"

23 changes: 17 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@

FLAGS=$(CXXFLAGS) -DBOOST_LOG_DYN_LINK -std=c++0x
LIBS=-lusb-1.0 -lboost_log -lboost_log_setup-mt -lboost_thread -lboost_system-mt -lpthread

all: g13d pbm2lpbm

g13d: g13.h g13.cc
g++ -o g13d -std=c++0x g13.cc -lusb-1.0
g13d: g13.o g13map.o g13logging.o
$(CXX) $(FLAGS) -o $@ $^ $(LIBS) $(LDFLAGS)

g13.o: g13.cc g13.h g13logging.h g13map.h logo.h
g13map.o: g13map.cc g13map.h
g13logging.o: g13logging.cc g13logging.h

%.o: %.cc
$(CXX) $(FLAGS) -c $(FLAGS) -o $@ $<

pbm2lpbm: pbm2lpbm.c
g++ -o pbm2lpbm pbm2lpbm.c
$(CXX) $(FLAGS) -o pbm2lpbm pbm2lpbm.c $(LDFLAGS)

package:
rm -Rf g13-userspace
mkdir g13-userspace
cp g13.cc g13.h logo.h Makefile pbm2lpbm.c g13-userspace
cp *.cc *.h Makefile g13-userspace
tar cjf g13-userspace.tbz2 g13-userspace
rm -Rf g13-userspace
clean:
rm -f g13 pbm2lpbm
clean:
rm -f g13d *.o pbm2lpbm
17 changes: 14 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ If you want to run the daemon as user, put the file 91-g13.rules into /etc/udev/
Connect your device, then run ./g13, 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 LIGHT_STATE M1 M2 M3 MR TOP STICK_LEFT STICK_RIGHT STICK_UP STICK_DOWN
Known keys to map to:
KEY_0 KEY_1 KEY_2 KEY_3 KEY_4 KEY_5 KEY_6 KEY_7 KEY_8 KEY_9 KEY_A KEY_APOSTROPHE KEY_B KEY_BACKSLASH KEY_BACKSPACE KEY_C KEY_CAPSLOCK KEY_COMMA KEY_D KEY_DOT KEY_DOWN KEY_E KEY_ENTER KEY_EQUAL KEY_ESC KEY_F KEY_F1 KEY_F10 KEY_F2 KEY_F3 KEY_F4 KEY_F5 KEY_F6 KEY_F7 KEY_F8 KEY_F9 KEY_G KEY_GRAVE KEY_H KEY_I KEY_J KEY_K KEY_KP0 KEY_KP1 KEY_KP2 KEY_KP3 KEY_KP4 KEY_KP5 KEY_KP6 KEY_KP7 KEY_KP8 KEY_KP9 KEY_KPASTERISK KEY_KPDOT KEY_KPMINUS KEY_KPPLUS KEY_L KEY_LEFT KEY_LEFTALT KEY_LEFTBRACE KEY_LEFTCTRL KEY_LEFTSHIFT KEY_M KEY_MINUS KEY_N KEY_NUMLOCK KEY_O KEY_P KEY_Q KEY_R KEY_RIGHT KEY_RIGHTBRACE KEY_RIGHTSHIFT KEY_S KEY_SCROLLLOCK KEY_SEMICOLON KEY_SLASH KEY_SPACE KEY_T KEY_TAB KEY_U KEY_UP KEY_V KEY_W KEY_X KEY_Y KEY_Z
Found 1 G13s

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

** Commands
Expand All @@ -38,6 +38,17 @@ would set M1, M3 and MR, and unset M2).

This binds a key. The possible values of <keyname> are shown upon startup (e.g. G1), same for <binding> (e.g. KEY_LEFTSHIFT).

A single G13 key press can be mapped to multiple key events using this syntax:
```
bind G1 KEY_LEFTCTRL KEY_F
bind G2 KEY_LEFTSHIFT KEY_G
bind G3 KEY_LEFTALT KEY_H
bind G4 KEY_LEFTCTRL KEY_LEFTSHIFT KEY_I
bind G5 KEY_LEFTCTRL KEY_LEFTSHIFT KEY_LEFTALT KEY_J
bind G6 KEY_LEFTCTRL KEY_LEFTSHIFT KEY_LEFTALT KEY_K # this is a comment
```
This is useful in the case of modifiers.

*** Stick mode

The stick can be used as an absolute input device or can send key events. Right now there is no command for this, you need to edit the source (file g13.cc, around line 622, this->stick_mode = STICK_KEYS, change to this->stick_mode = STICK_ABSOLUTE).
Expand All @@ -50,4 +61,4 @@ Use pbm2lpbm to convert a pbm image to the correct format, then just cat that in
The pbm file must be 160x43 pixels.

* License
This code is placed in the public domain. Do with it whatever you want.
This code is placed in the public domain. Do with it whatever you want.
Loading