|
|
|
@ -432,7 +432,10 @@ int main (int argc, char *argv[])
|
|
|
|
|
struct input_event event;
|
|
|
|
|
struct input_event revev;
|
|
|
|
|
struct uinput_user_dev devinfo={{0},{0}};
|
|
|
|
|
int devout[MAX_KEYBOARDS], rd, i, size = sizeof (struct input_event);
|
|
|
|
|
int devout[MAX_KEYBOARDS];
|
|
|
|
|
int rd;
|
|
|
|
|
int i;
|
|
|
|
|
int size = sizeof (struct input_event);
|
|
|
|
|
char name[256] = "Unknown";
|
|
|
|
|
bool ctrl_down = false;
|
|
|
|
|
bool alt_down = false;
|
|
|
|
@ -593,26 +596,23 @@ int main (int argc, char *argv[])
|
|
|
|
|
if (i<0) return 9; // fork failed
|
|
|
|
|
if (i>0) {
|
|
|
|
|
child_pids[current_keyboard] = i;
|
|
|
|
|
|
|
|
|
|
int i=fork();
|
|
|
|
|
if (i<0) return 9; // fork failed
|
|
|
|
|
if (i>0) {
|
|
|
|
|
child_led_pids[current_keyboard] = i;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
setupLockingPipe(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
established = true;
|
|
|
|
|
|
|
|
|
|
if (testrun == true) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int i=fork();
|
|
|
|
|
if (i<0) return 9; // fork failed
|
|
|
|
|
if (i>0) {
|
|
|
|
|
child_led_pids[current_keyboard] = i;
|
|
|
|
|
while (1) {
|
|
|
|
|
// Replicate LED events from the virtual keyboard to the physical keyboard
|
|
|
|
|
int rrd = read(devout[current_keyboard], &revev, size);
|
|
|
|
|
if (rrd >= size) {
|
|
|
|
|
if (revev.type == EV_LED) {
|
|
|
|
|
if ((revev.type == EV_LED) || (revev.type == EV_MSC)) {
|
|
|
|
|
if (write(keyboard_fds[current_keyboard], &revev, sizeof(revev)) < 0) {
|
|
|
|
|
fprintf(stderr, "[tsak] Unable to replicate LED event\n");
|
|
|
|
|
}
|
|
|
|
@ -621,6 +621,14 @@ int main (int argc, char *argv[])
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
setupLockingPipe(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
established = true;
|
|
|
|
|
|
|
|
|
|
if (testrun == true) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
if ((rd = read(keyboard_fds[current_keyboard], ev, size)) < size) {
|
|
|
|
|