Comments (4)
First, there is a kernel patch - this is dark magic, without which nothing
will work. This patch adds two new devices to your Android system,
/dev/hidg0 for keyboard, and /dev/hidg1 for mouse.
If you want to add HID joystick for example, you need to modify
hid_function_bind_config() and hid_function_init(), and another struct
ghid_device_android_joystick, with proper USB descriptor.
The best way to get USB descriptor is to buy USB analyzer, and copy data
from existing USB joystick. You can also read USB specification:
http://en.wikipedia.org/wiki/USB_human_interface_device_class
Then you need Android application, which will write data to these devices.
It doesn't matter if it's written in C or Java, as long as it writes valid
data to these files.
Keyboard/mouse protocol description is here:
https://github.com/pelya/android-keyboard-gadget#how-it-works
My Android app is written in C++ and uses SDL library. gfx.cpp contains
low-level graphics functions, gui.cpp is a GUI widgets implementation,
flash-kernel.cpp is for flashing kernel on Nexus 7, input.cpp is for
opening device files and writing data to them, main.cpp is, well, main(),
touchpad.cpp is the touchpad implementation, and scancodes.cpp contains
keyboard scancode table.
On Mon, Nov 10, 2014 at 12:45 PM, the-st0rm [email protected]
wrote:
What should I read exactly to understand what you have coded entirely. I
need something like a walkthough of your code to understand what is this
function and why it is used etc etc, so that I can develop on top of that.Best Regards
—
Reply to this email directly or view it on GitHub
#12.
from android-keyboard-gadget.
I understand this big picture and I am ok with the Android application that writes the data to the devices. My only problem is with the kernel patch. Understanding what is happening actually.
what happened when I just connect my phone to the PC what function gets called first and how the data is sent to the USB ... and what is the difference between the hid_function_bind_config() and hid_function_init() .. I don't want you to answer all these stuff, I just want you to direct me to the source you read so that you managed to write all that code. Got me ?
BTW, Thank you so much for your effor and your quick respones. You are amazing dude
I really appreciate it everything you do.
from android-keyboard-gadget.
I do not know all details myself, because the kernel is huge, I only know
how my code works.
First, I've read this documemt, it contains half-baked example of what I
needed:
https://github.com/torvalds/linux/blob/master/Documentation/usb/gadget_hid.txt
Then I've scanbed through Android USB gadget implementation, where
functions are added and removed dynamically:
HID gadget already has it's own driver, I needed only to provide USB HID
descriptor:
Then I fixed compilation errors, run, debugged crashes, usual stuff.
On Nov 10, 2014 2:51 PM, "the-st0rm" [email protected] wrote:
I understand this big picture and I am ok with the Android application
that writes the data to the devices. My only problem is with the kernel
patch. Understanding what is happening actually.
what happened when I just connect my phone to the PC what function gets
called first and how the data is sent to the USB ... and what is the
difference between the hid_function_bind_config() and hid_function_init()
.. I don't want you to answer all these stuff, I just want you to direct me
to the source you read so that you managed to write all that code. Got me ?
BTW, Thank you so much for your effor and your quick respones. You are
amazing dude
I really appreciate it everything you do.—
Reply to this email directly or view it on GitHub
#12 (comment)
.
from android-keyboard-gadget.
Question has been answered, therefore closing.
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.