Giter Club home page Giter Club logo

Comments (10)

pelya avatar pelya commented on July 21, 2024

Yes, you just open /dev/hidg0 as a regular file, and write into it. Here's
a piece of code that does this:
https://github.com/pelya/android-keyboard-gadget/blob/master/hid-gadget-test/jni/hid-gadget-test.c#L178
The format of the bytes sent is described in readme:
https://github.com/pelya/android-keyboard-gadget#how-it-works

Because of SELinux, Android app cannot open the file directly, so it
launches su and pipes data through it, something like FILE *pipe =
popen("su"); fprintf(pipe, "cat > /dev/hidg0\n"); then write keycodes to
pipe, and don't forget to fflush().

On Sat, Jul 9, 2016 at 8:47 PM, Tim Wanders [email protected]
wrote:

hello @pelya https://github.com/pelya I have a question:
I am creating a hid app but I don't want to work with the hid-gadget-test
file. Is it possible to build it into my app to send keystrokes from your
hid patch?(I am using xamarin(mono for android/ C# for android)
Regards,
Tim


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#53, or mute the
thread
https://github.com/notifications/unsubscribe/AAJewKd9uhKq0uNx8UQuRH4aRrt07SHDks5qT967gaJpZM4JIqn9
.

from android-keyboard-gadget.

Rosalie241 avatar Rosalie241 commented on July 21, 2024

If Selinux is diabled I
can do someting like this right?:
Echo 0x01 | /dev/hidg0

from android-keyboard-gadget.

pelya avatar pelya commented on July 21, 2024

Yes you can.
On Jul 9, 2016 10:34 PM, "Tim Wanders" [email protected] wrote:

If Selinux is diabled I
can do someting like this right?:
Echo 0x01 | /dev/hidg0


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#53 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAJewNitXA72_Ezd_MBYq1aVjWTivFqnks5qT_e-gaJpZM4JIqn9
.

from android-keyboard-gadget.

Rosalie241 avatar Rosalie241 commented on July 21, 2024

can you give me some more details about that " FILE *pipe =
popen("su"); fprintf(pipe, "cat > /dev/hidg0\n"); then write keycodes to
pipe, and don't forget to fflush()."? the command does not seems to work. ANd I am not understanding it.

from android-keyboard-gadget.

pelya avatar pelya commented on July 21, 2024

It's a piece of C code, I don't know how are you doing file writing in C#.
Open /dev/hidg0 and write into it chunks 8 bytes each, flush the buffer
after each write, that's it.
On Jul 10, 2016 8:56 AM, "Tim Wanders" [email protected] wrote:

can you give me some more details about that " FILE *pipe =
popen("su"); fprintf(pipe, "cat > /dev/hidg0\n"); then write keycodes to
pipe, and don't forget to fflush()."? the command does not seems to work.
ANd I am not understanding it.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#53 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAJewJp2BDllR5dQE8Oc_GF_58OSq6Crks5qUImWgaJpZM4JIqn9
.

from android-keyboard-gadget.

Rosalie241 avatar Rosalie241 commented on July 21, 2024

if I create a test file(located on sdcard with: 0x0a in it) if I do a root shell and then: cat /sdcard/test > /dev/hidg0 but then it spams an random key from my keyboard, any idea?

from android-keyboard-gadget.

Rosalie241 avatar Rosalie241 commented on July 21, 2024

or can you explain how to do it with the terminal? Because I can easilly send shell commands like cat in su.

from android-keyboard-gadget.

pelya avatar pelya commented on July 21, 2024

Yes, you can copypaste a text file.
Please read the keyboard protocol description at
https://github.com/pelya/android-keyboard-gadget#how-it-works
You send 8 bytes at once, not 1, and the first byte is special.
On Jul 10, 2016 9:05 PM, "Tim Wanders" [email protected] wrote:

or can you explain how to do it with the terminal? Because I can easilly
send shell commands like cat in su.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#53 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAJewK4cWF6-mt9MO6QF81T0gufEWOHTks5qUTRQgaJpZM4JIqn9
.

from android-keyboard-gadget.

Rosalie241 avatar Rosalie241 commented on July 21, 2024

I still don't understand it :-(

from android-keyboard-gadget.

Rosalie241 avatar Rosalie241 commented on July 21, 2024

nevermind, I will use the hid-gadget test utillity :-)

from android-keyboard-gadget.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.