void openInput() { if( !deviceExist(DEV_KEYBOARD) || !deviceExist(DEV_MOUSE) ) { flashCustomKernel(); return; } openDevices(); if( keyboardFd == -1 || mouseFd == -1 ) { changeDevicePermissions(); openDevices(); } if( keyboardFd == -1 || mouseFd == -1 ) { openDevicesSuperuser(); } if( (keyboardFd == -1 || mouseFd == -1) ) { char cmd[256]; createDialog(); addDialogText("Your kernel is supported by this app"); addDialogText("But your system is not rooted - cannot open device files"); addDialogText("Please execute following command from the root shell, and restart this app:"); sprintf(cmd, "chmod 666 %s %s", DEV_KEYBOARD, DEV_MOUSE); addDialogText(cmd); addDialogText("If this does not help, disable SELinux with command:"); strcpy(cmd, "tbsbiahudb'7"); // "setenforce 0" xor 0x7, in case Google Play has automated app removal bot for (int i = 0; i < strlen(cmd); i++) cmd[i] ^= 0x7; addDialogText(cmd); addDialogText("Press Back to exit"); while( true ) mainLoop(); exit(0); } if( keyboardFd == -1 || mouseFd == -1 ) flashCustomKernel(); readKeyMappings(); }
void clearDialogText() { for(int i = 0; i < DIALOG_MESSAGE_LINES; i++) addDialogText(""); }