Skip to content

Commit

Permalink
Merge pull request kernc#139 from jzohrab/recognize_logitech
Browse files Browse the repository at this point in the history
Recognize Logitech

Closes kernc#136, closes kernc#134, closes kernc#129, closes kernc#120, closes kernc#126, closes kernc#90, closes kernc#105, closes kernc#116
  • Loading branch information
kernc committed Feb 6, 2016
2 parents 78321c6 + 5560126 commit ffcc2ba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/logkeys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#endif

#define COMMAND_STR_DUMPKEYS ( EXE_DUMPKEYS " -n | " EXE_GREP " '^\\([[:space:]]shift[[:space:]]\\)*\\([[:space:]]altgr[[:space:]]\\)*keycode'" )
#define COMMAND_STR_DEVICES ( EXE_GREP " -E 'Handlers|EV=' /proc/bus/input/devices | " EXE_GREP " -B1 'EV=120013' | " EXE_GREP " -Eo 'event[0-9]+' ")
#define COMMAND_STR_GET_PID ( (std::string(EXE_PS " ax | " EXE_GREP " '") + program_invocation_name + "' | " EXE_GREP " -v grep").c_str() )

#define INPUT_EVENT_PATH "/dev/input/" // standard path
Expand Down Expand Up @@ -331,7 +330,11 @@ void determine_input_device()
setegid(65534); seteuid(65534);

// extract input number from /proc/bus/input/devices (I don't know how to do it better. If you have an idea, please let me know.)
std::stringstream output(execute(COMMAND_STR_DEVICES));
// The compiler automatically concatenates these adjacent strings to a single string.
const char* cmd = EXE_GREP " -E 'Handlers|EV=' /proc/bus/input/devices | "
EXE_GREP " -B1 'EV=1[02]001[3Ff]' | "
EXE_GREP " -Eo 'event[0-9]+' ";
std::stringstream output(execute(cmd));

std::vector<std::string> results;
std::string line;
Expand Down

0 comments on commit ffcc2ba

Please sign in to comment.