Comments (6)
I've pushed a fix, please tell me if it works for you.
On Sun, Nov 30, 2014 at 4:36 PM, Benoit Pierre [email protected]
wrote:
I have 2 devices:
- a Sony Xperia Tipo running CyanogenMod 10 (Jelly Bean 4.1.2), with a
kernel patched with your HID patch (3.0.8)- a Nexus 7 (2013) running CyanogenMod 11 (KitKat 4.4.4), still using
the CyanogenMod kernel (so without the HID patch)Version 1.05 works fine on both:
- on the Tipo, mouse and keyboard work fine
- on the Nexus, of course I get the screen telling me a custom kernel
is neededWith the latest 1.06 version however:
- on the Nexus: I get left with a black screen after the SDL splash
screen and allowing root access- on the Tipo: it works fine, if version 1.05 has been started before,
but I get the same thing as the Nexus after rebootingOne difference before and after running 1.05 is the devices rights.
Before:
adb shell ls -l /dev/hidg*
crw------- root root 244, 0 2014-11-30 15:24 hidg0
crw------- root root 244, 1 2014-11-30 15:24 hidg1After:
adb shell ls -l /dev/hidg*
crw------- u0_a62 root 244, 0 2014-11-30 15:24 hidg0
crw------- u0_a62 root 244, 1 2014-11-30 15:24 hidg1—
Reply to this email directly or view it on GitHub
#18.
from android-keyboard-gadget.
It works fine on the Tipo, but I still get a black screen on the Nexus. It seems the code does not detect that the devices are missing; as I can see from the traces it's trying to fix the permissions on those:
I/HID keyboard( 9490): void changeDevicePermissions(): echo chown 10107 /dev/hidg0 /dev/hidg1 | su
I/HID keyboard( 9490): void changeDevicePermissions(): echo chmod 600 /dev/hidg0 /dev/hidg1 | su
Also, looking at the code, there is no check for the exit status of those commands.
from android-keyboard-gadget.
Yes, the problem is that on Lollipop the /dev directory cannot be searched,
so I've used a trick with su command to determine if these files exist, but
this trick does not work on your device. More improvements are necessary,
but at least it's not broken now.
On Mon, Dec 1, 2014 at 10:52 PM, Benoit Pierre [email protected]
wrote:
It works fine on the Tipo, but I still get a black screen on the Nexus. It
seems the code does not detect that the devices are missing; as I can see
from the traces the code is trying to fix the permissions on those:I/HID keyboard( 9490): void changeDevicePermissions(): echo chown 10107 /dev/hidg0 /dev/hidg1 | su
I/HID keyboard( 9490): void changeDevicePermissions(): echo chmod 600 /dev/hidg0 /dev/hidg1 | suAlso, looking at the code, there is no check for the exit status of those
commands.—
Reply to this email directly or view it on GitHub
#18 (comment)
.
from android-keyboard-gadget.
OK, so I took a closer look at this, and it's still possible to check for the devices existence on Lollipop;
since stat will return an error whether or not the device is present, but errno will be different:
- EACCES if the device exists; because we don't have permission to stat it (technically could happen if we don't have access to one of the prefix path, but not an issue in this case since stat(/dev) is ok)
- ENOENT if the device does not exist
Here is a patch for this:
diff --git i/remote-client/input.cpp w/remote-client/input.cpp
index d3c2bc8..0d8dddd 100644
--- i/remote-client/input.cpp
+++ w/remote-client/input.cpp
@@ -131,16 +131,24 @@ static void changeDevicePermissions()
system(cmd);
}
-static int devicesExist()
+static int deviceExist(const char *path)
{
struct stat st;
- if (stat(DEV_KEYBOARD, &st) == 0 && stat(DEV_MOUSE, &st) == 0)
- return 1;
- return 0;
+
+ /*
+ ** On Lollipop, we don't have permission to stat a device; but we know
+ ** it exists because errno is set to EACCES, and not ENOENT.
+ */
+ return 0 == stat(path, &st) || EACCES == errno;
}
void openInput()
{
+ if( !deviceExist(DEV_KEYBOARD) || !deviceExist(DEV_MOUSE) )
+ {
+ flashCustomKernel();
+ return;
+ }
openDevices();
if( keyboardFd == -1 || mouseFd == -1 )
{
@@ -151,7 +159,7 @@ void openInput()
{
openDevicesSuperuser();
}
- if( (keyboardFd == -1 || mouseFd == -1) && devicesExist() )
+ if( (keyboardFd == -1 || mouseFd == -1) )
{
char cmd[256];
createDialog();
Tested on my Tipo and Nexus 7 (updated to stock Lollipop), with and without a kernel patched with USB HID gadget support.
from android-keyboard-gadget.
Merged that, thanks. I'll add one feature to the app, and publish an update, in a week or so.
from android-keyboard-gadget.
On the second thought, I've pushed an update, with just this patch. The feature I want to implement might take a lot of time.
from android-keyboard-gadget.
Related Issues (20)
- Some Questions...Pls Help HOT 2
- Stuck on opening HOT 10
- need hid patch for 4.4.117 kernel
- Ji
- Keyboard
- Require patch for samsung grand 2
- nokia 1020 HOT 1
- No f_hid.c found pls help
- pelya/Android_keyword gadget
- Permissions bug HOT 2
- rdp support HOT 1
- could you add support for samsung galaxy j3 (2016)
- Please send the poc_android files
- what is the VNC password?
- Pin
- How to get or Where can i find the hid-keyboard file?
- Add redmi note 4 support
- No 64bit support
- hid-gadget-test behaving strange
- Well
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-keyboard-gadget.