summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-03 15:44:29 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-03 15:44:29 -0500
commit86cc65ce51ca652ff1e7517bf29fcd375639719f (patch)
tree7f58b4a41bb9f3d009c563fde4cabb9a3ce4121e
parent2a889fe31478e2b58e98ce568a5eafbc04ac287b (diff)
downloadtdebase-86cc65ce51ca652ff1e7517bf29fcd375639719f.tar.gz
tdebase-86cc65ce51ca652ff1e7517bf29fcd375639719f.zip
Fix tsak corrupting input events
This resolves Bug 1423 Thanks to Slavek for the patch! Clean up tsak debug output Remove spurious checks from tsak main replication loop
-rw-r--r--tsak/main.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/tsak/main.cpp b/tsak/main.cpp
index 652466852..7b3202f16 100644
--- a/tsak/main.cpp
+++ b/tsak/main.cpp
@@ -386,11 +386,20 @@ void restart_tsak()
// Release all exclusive keyboard locks
for (int current_keyboard=0;current_keyboard<keyboard_fd_num;current_keyboard++) {
if(ioctl(keyboard_fds[current_keyboard], EVIOCGRAB, 0) < 0) {
- fprintf(stderr, "[tsak] Failed to release exclusive input device lock");
+ fprintf(stderr, "[tsak] Failed to release exclusive input device lock\n");
}
close(keyboard_fds[current_keyboard]);
}
+ // Unset the exclusive file lock
+ if (mPipe_fd_out != -1) {
+ struct flock fl;
+ if (fcntl(mPipe_fd_out, F_UNLCK, &fl) == -1) {
+ fprintf(stderr, "[tsak] Failed to release exclusive pipe lock\n");
+ }
+ close(mPipe_fd_out);
+ }
+
#if 1
// Restart now
// Note that the execl function never returns
@@ -498,14 +507,14 @@ int main (int argc, char *argv[])
}
if ((getuid ()) != 0) {
- printf ("You are not root! This WILL NOT WORK!\nDO NOT attempt to bypass security restrictions, e.g. by changing keyboard permissions or owner, if you want the SAK system to remain secure...\n");
+ printf ("[tsak] You are not root! This WILL NOT WORK!\nDO NOT attempt to bypass security restrictions, e.g. by changing keyboard permissions or owner, if you want the SAK system to remain secure...\n");
return 5;
}
// Find keyboards
find_keyboards();
if (keyboard_fd_num == 0) {
- printf ("Could not find any usable keyboard(s)!\n");
+ printf ("[tsak] Could not find any usable keyboard(s)!\n");
if (depcheck == true) {
return 50;
}
@@ -658,10 +667,10 @@ int main (int argc, char *argv[])
}
}
- if ((hide_event == false) && (ev[0].type != EV_LED) && (ev[1].type != EV_LED)) {
+ if ((hide_event == false) && (ev[0].type != EV_LED) && (ev[0].type != EV_MSC)) {
// Pass the event on...
event = ev[0];
- if (write(devout[current_keyboard], &event, sizeof event) < 0) {
+ if (write(devout[current_keyboard], &event, sizeof(event)) < 0) {
fprintf(stderr, "[tsak] Unable to replicate keyboard event!\n");
}
}