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

Multiplexing input devices #171

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@triclops200
Copy link

commented Oct 2, 2017

This can now gracefully handle multiple input devices

@kernc

kernc approved these changes Oct 2, 2017

Copy link
Owner

left a comment

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.

Copy link
@kernc

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.

Copy link
@triclops200

triclops200 Oct 2, 2017

Author

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);
}

This comment has been minimized.

Copy link
@kernc

kernc Oct 2, 2017

Owner

Could this re-setting snippet be put up, above select() call?

This comment has been minimized.

Copy link
@triclops200

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.

Copy link
@kernc

kernc Oct 2, 2017

Owner

Signed int here raises a compilation warning.

This comment has been minimized.

Copy link
@triclops200

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.

@triclops200

This comment has been minimized.

Copy link
Author

commented Nov 30, 2017

I haven't forgotten about this, I just got extremly busy. I'll get the other changes in later.

@rightaway

This comment has been minimized.

Copy link

commented Nov 20, 2018

Would this PR solve this issue for logging from all keyboards or it's something different? #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.