|
|
@ -139,12 +139,13 @@ static void copy_features(int devin, int devout)
|
|
|
|
if (op == -1) continue;
|
|
|
|
if (op == -1) continue;
|
|
|
|
ioctl(devout, UI_SET_EVBIT, i);
|
|
|
|
ioctl(devout, UI_SET_EVBIT, i);
|
|
|
|
memset(codes,0,sizeof(codes));
|
|
|
|
memset(codes,0,sizeof(codes));
|
|
|
|
if (ioctl(devin, EVIOCGBIT(i, sizeof(codes)), codes) < 0) return;
|
|
|
|
if (ioctl(devin, EVIOCGBIT(i, sizeof(codes)), codes) >= 0) {
|
|
|
|
for(code=0;code<KEY_MAX;code++) {
|
|
|
|
for(code=0;code<KEY_MAX;code++) {
|
|
|
|
if (bit_set(code, codes)) ioctl(devout, op, code);
|
|
|
|
if (bit_set(code, codes)) ioctl(devout, op, code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int find_keyboards() {
|
|
|
|
int find_keyboards() {
|
|
|
|
int i, j;
|
|
|
|
int i, j;
|
|
|
@ -342,6 +343,7 @@ int main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct input_event ev[64];
|
|
|
|
struct input_event ev[64];
|
|
|
|
struct input_event event;
|
|
|
|
struct input_event event;
|
|
|
|
|
|
|
|
struct input_event revev;
|
|
|
|
struct uinput_user_dev devinfo={0};
|
|
|
|
struct uinput_user_dev devinfo={0};
|
|
|
|
int devout[MAX_KEYBOARDS], rd, i, value, size = sizeof (struct input_event);
|
|
|
|
int devout[MAX_KEYBOARDS], rd, i, value, size = sizeof (struct input_event);
|
|
|
|
char name[256] = "Unknown";
|
|
|
|
char name[256] = "Unknown";
|
|
|
@ -416,9 +418,9 @@ int main (int argc, char *argv[])
|
|
|
|
fprintf(stderr, "Reading from keyboard: (%s)\n", name);
|
|
|
|
fprintf(stderr, "Reading from keyboard: (%s)\n", name);
|
|
|
|
|
|
|
|
|
|
|
|
// Create filtered virtual output device
|
|
|
|
// Create filtered virtual output device
|
|
|
|
devout[current_keyboard]=open("/dev/misc/uinput",O_WRONLY|O_NONBLOCK);
|
|
|
|
devout[current_keyboard]=open("/dev/misc/uinput",O_RDWR|O_NONBLOCK);
|
|
|
|
if (devout[current_keyboard]<0) {
|
|
|
|
if (devout[current_keyboard]<0) {
|
|
|
|
devout[current_keyboard]=open("/dev/uinput",O_WRONLY|O_NONBLOCK);
|
|
|
|
devout[current_keyboard]=open("/dev/uinput",O_RDWR|O_NONBLOCK);
|
|
|
|
if (devout[current_keyboard]<0) {
|
|
|
|
if (devout[current_keyboard]<0) {
|
|
|
|
perror("open(\"/dev/misc/uinput\")");
|
|
|
|
perror("open(\"/dev/misc/uinput\")");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -484,6 +486,14 @@ int main (int argc, char *argv[])
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
|
|
|
|
write(keyboard_fds[current_keyboard], &revev, sizeof(revev));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
value = ev[0].value;
|
|
|
|
value = ev[0].value;
|
|
|
|
|
|
|
|
|
|
|
|
if (value != ' ' && ev[1].value == 0 && ev[1].type == 1){ // Read the key release event
|
|
|
|
if (value != ' ' && ev[1].value == 0 && ev[1].type == 1){ // Read the key release event
|
|
|
@ -506,7 +516,7 @@ int main (int argc, char *argv[])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (hide_event == false) {
|
|
|
|
if ((hide_event == false) && (ev[0].type != EV_LED) && (ev[1].type != EV_LED)) {
|
|
|
|
// Pass the event on...
|
|
|
|
// Pass the event on...
|
|
|
|
event = ev[0];
|
|
|
|
event = ev[0];
|
|
|
|
write(devout[current_keyboard], &event, sizeof event);
|
|
|
|
write(devout[current_keyboard], &event, sizeof event);
|
|
|
|