@ -184,97 +184,130 @@ int main (int argc, char *argv[])
boolctrl_down=false;
boolctrl_down=false;
boolalt_down=false;
boolalt_down=false;
boolhide_event=false;
boolhide_event=false;
boolestablished=false;
booltestrun=false;
// Create the output pipe
if(argc==2){
PipeHandlercontrolpipe;
if(strcmp(argv[1],"checkactive")==0){
testrun=true;
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");
fprintf(stderr,"Unable to open /dev/uinput or /dev/misc/uinput (char device 10:223).\nPossible causes: Device node inexistent or kernel not compiled with evdev user level driver support or permission denied.\n");
fprintf(stderr,"Unable to create input device with UI_DEV_CREATE\n");
return2;
}
else{
fprintf(stderr,"Device created.\n");
}
if(ioctl(fd,EVIOCGRAB,2)<0){
// Create the output pipe
close(fd);
PipeHandlercontrolpipe;
fprintf(stderr,"Failed to grab exclusive input device lock");
return1;
}
while(1){
while(1){
if((getuid())!=0){
if((rd=read(fd,ev,size*2))<size){
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");
fprintf(stderr,"Read failed.\n");
return5;
return1;
}
}
value=ev[0].value;
// Open Device
fd=find_keyboard();
if(value!=''&&ev[1].value==0&&ev[1].type==1){// Read the key release event
fprintf(stderr,"Unable to open /dev/uinput or /dev/misc/uinput (char device 10:223).\nPossible causes: Device node inexistent or kernel not compiled with evdev user level driver support or permission denied.\n");