Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upMultiplexing input devices #171
Conversation
bryan-hoyle
added some commits
Oct 2, 2017
kernc
approved these changes
Oct 2, 2017
|
Save the indentation hodgepodge, which is absolutely not your fault, it looks good to me, thanks! Just a few comments. |
| } | ||
| else { // event device supplied as -d argument | ||
| std::string::size_type i = args.device.find_last_of('/'); | ||
| args.device = (std::string(INPUT_EVENT_PATH) + args.device.substr(i == std::string::npos ? 0 : i + 1)); | ||
| results.push_back((std::string(INPUT_EVENT_PATH) + args.device.substr(i == std::string::npos ? 0 : i + 1))); |
This comment has been minimized.
This comment has been minimized.
kernc
Oct 2, 2017
Owner
Could this be made to support multiple -d switches?
Or perhaps comma-separated -d device1,device2,device3?
This comment has been minimized.
This comment has been minimized.
| for(unsigned long i = 0; i < input_fds.size() && x > 0; i++){ | ||
| int fd = input_fds[i]; | ||
| FD_SET(fd, &read_fds); | ||
| } |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
triclops200
Oct 2, 2017
Author
Yes, should be, but it needs the FD_ZERO line as well. That would also allow de-complecting the initial set setup above the while loop as well.
|
|
||
| void signal_handler(int signal) | ||
| { | ||
| if (input_fd != -1) | ||
| close(input_fd); // closing input file will break the infinite while loop | ||
| for(int i = 0; i < input_fds.size(); i++){ |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
triclops200
Oct 2, 2017
Author
Oops, I'll change that sometime in the afternoon in the next week or so. If you want to make the change, it should be an unsigned long i.
This comment has been minimized.
This comment has been minimized.
|
I haven't forgotten about this, I just got extremly busy. I'll get the other changes in later. |
This comment has been minimized.
This comment has been minimized.
rightaway
commented
Nov 20, 2018
|
Would this PR solve this issue for logging from all keyboards or it's something different? #38 |
triclops200 commentedOct 2, 2017
This can now gracefully handle multiple input devices