-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Multiplexing input devices #171
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be made to support multiple -d
switches?
Or perhaps comma-separated -d device1,device2,device3
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also will take care of in the next week or so.
for(unsigned long i = 0; i < input_fds.size() && x > 0; i++){ | ||
int fd = input_fds[i]; | ||
FD_SET(fd, &read_fds); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this re-setting snippet be put up, above select()
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed int here raises a compilation warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.
I haven't forgotten about this, I just got extremly busy. I'll get the other changes in later. |
Would this PR solve this issue for logging from all keyboards or it's something different? #38 |
This can now gracefully handle multiple input devices