Ejemplo n.º 1
0
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();
}
Ejemplo n.º 2
0
void openInput()
{
	openDevices();
	if( devicesExist() && (keyboardFd == -1 || mouseFd == -1) )
	{
		changeDevicePermissions();
		openDevices();
	}
	if( keyboardFd == -1 || mouseFd == -1 )
		flashCustomKernel();
	for( int k = SDLK_FIRST; k < SDLK_LAST; k++ )
	{
		for( int s = 0; s < SDL_NUM_SCANCODES; s++ )
		{
			if( scancodes_table[s] == k )
			{
				keycode_to_scancode[k] = s;
				break;
			}
		}
	}
}