/** * @see findDevice(const char*) * @see open(int) */ DigitalCameraCapture::DigitalCameraCapture(const String & deviceName) { initContext(); int index = findDevice(deviceName.c_str()); if (deviceExist(index)) open(index); }
void DISICLTransceiver::UpdateDynamicDeviceTable( const TUint8 aDynamicDevId, const TUint8 aStaticDevId ) { C_TRACE( ( _T( "DISICLTransceiver::UpdateDynamicDeviceTable 0x%x 0x%x>" ), aDynamicDevId, aStaticDevId) ); TBool deviceExist(EFalse); TInt count(iDynamicDeviceTable.Count()); TInt err( Kern::MutexWait( *iDynamicDeviceTableMutex ) ); ASSERT_RESET_ALWAYS( ( err == KErrNone ), ( EISICLTransceiverMutexWaitFailed2 | EDISICLTransceiverTraceId << KClassIdentifierShift ) ); for( TUint8 i = 0; i < count; i++ ) { C_TRACE( ( _T( "DISICLTransceiver::UpdateDynamicDeviceTable find dynamic device %d" ), i) ); if( iDynamicDeviceTable[ i ]->iDynamicDevId == aDynamicDevId ) { C_TRACE( ( _T( "DISICLTransceiver::UpdateDynamicDeviceTable dyn dev exist i = %d aDynamicDevId 0x%x staticDevId 0x%x previous 0x%x" ), i, iDynamicDeviceTable[ i ]->iDynamicDevId, aStaticDevId, iDynamicDeviceTable[ i ]->iStaticDevId ) ); iDynamicDeviceTable[ i ]->iStaticDevId = aStaticDevId; deviceExist = ETrue; break; } } if ( !deviceExist ) { C_TRACE( ( _T( "DISICLTransceiver::UpdateDynamicDeviceTable new dynamic device added 0x%x 0x%x" ), aDynamicDevId, aStaticDevId ) ); iDynamicDeviceTable.Append( new TDynamicDevice( aDynamicDevId, aStaticDevId ) ); } Kern::MutexSignal( *iDynamicDeviceTableMutex ); C_TRACE( ( _T( "DISICLTransceiver::UpdateDynamicDeviceTable 0x%x 0x%x<" ), aDynamicDevId, aStaticDevId) ); }
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(); }