Hi everyone,
I have been trying for quite a while now to compile HID Gadget support for my galaxy S3 and think i may be getting close. My current problem is that when i run insmod g_hid.ko i receive the following
Code:
insmod: init_module 'g_hid.ko' failed (Device or resource busy)
. The weird thing is that next time the screen turns off or if i attempt to insert it again the phone crashes (kernel panic i assume). I get this same error when i try and insmod g_zero.ko (although this one doesn't kill the phone). Can anyone tell me how i would attempt to debug this? Or even better, has anyone got g_hid working on there phone and if so, what modifications/kernel configs did you use?
Also, when compiling the kernel, in "USB gadget support" if i select any option other than Android Gadget in USB Gadget Drivers my kernel fails to build. Has anyone got any USB gadgets to compile and run and if so what procedure/modifications did you have to make. Currently i am compiling my kernel with android gadget selected as the usb gadget driver and then changing it to HID module and running make module_prepair and make module to get my .ko files (which may be why i am getting the above error).
If anyone can provide some insite and advice it would be greatly appreciated.
Thank you
Adrian
After months of trying, it appears i have got it solved. Unfortunately its not the most graceful solution and currently it disables MTP but i dont care. To fix it i searched every file in the kernel for mentions of CONFIG_USB_G_ANDROID and everywhere it was involved in an #if defined statement i added another section like so
Code:
#if defined(CONFIG_USB_ANDROID) || defined(CONFIG_USB_G_ANDROID) || defined(CONFIG_USB_S3C_OTGD)
In this case i added USB_S3C_OTG. As i said, it isn't pretty but it works.
Hope this helps someone in the future coz there is very little info on the net about this
Enjoy
Adrian
Code sample
I asked a question on Stack Overflow about exactly this issue. There is a small group of people who seem quite interested in this issue, and there really is not a lot of information on the net.
I would very much appreciate if you could explain in a little more detail what steps you took to get this to work for you. You could probably answer the Stack Overflow question more decisively than the current answers too: stack-overflow questions/9805731 - is-it-possible-to-program-android-to-act-as-physical-usb-keyboard. (I can't post the link as this forum blocks it.)
darcpyro said:
After months of trying, it appears i have got it solved. Unfortunately its not the most graceful solution and currently it disables MTP but i dont care. To fix it i searched every file in the kernel for mentions of CONFIG_USB_G_ANDROID and everywhere it was involved in an #if defined statement i added another section like so
Code:
#if defined(CONFIG_USB_ANDROID) || defined(CONFIG_USB_G_ANDROID) || defined(CONFIG_USB_S3C_OTGD)
In this case i added USB_S3C_OTG. As i said, it isn't pretty but it works.
Hope this helps someone in the future coz there is very little info on the net about this
Enjoy
Adrian
Click to expand...
Click to collapse
No worries, im happy to help. The funny thing is by reading the answers you got it started me on the right path to finding a solution. Im not sure how this will translate to other devices firmware but in the case of the galaxy S3 it was i went threw every file and added the
Code:
|| defined(CONFIG_USB_S3C_OTGD)
to all if defined statement that made any mention of CONFIG_USB_GADGET so that the code inside would be compiled. This was so that in the .config file for the kernel CONFIG_USB_GADGET would be set to yes and would then allow the hid driver to be compiled. Basically every time i got an error i saying something wasn't compiled or wasn't declared i went to that file, found where it was declared and added that if defined statement. I would upload my working source code but it would take weeks on my internet connection. If there is a specific file you want to see then let me know and i will post its contents.
Good luck
Adrian
darcpyro said:
No worries, im happy to help. The funny thing is by reading the answers you got it started me on the right path to finding a solution. Im not sure how this will translate to other devices firmware but in the case of the galaxy S3 it was i went threw every file and added the
Code:
|| defined(CONFIG_USB_S3C_OTGD)
to all if defined statement that made any mention of CONFIG_USB_GADGET so that the code inside would be compiled. This was so that in the .config file for the kernel CONFIG_USB_GADGET would be set to yes and would then allow the hid driver to be compiled. Basically every time i got an error i saying something wasn't compiled or wasn't declared i went to that file, found where it was declared and added that if defined statement. I would upload my working source code but it would take weeks on my internet connection. If there is a specific file you want to see then let me know and i will post its contents.
Good luck
Adrian
Click to expand...
Click to collapse
Hi Adrian
did you manage to use your android phone as a keyboard with USB_H_HID module ? I'm trying to do the same thing and I would be interested if you have more informations. For now, I had cyanogendmod source for Samsung Galaxy S III and I've compiled the default 10.1 ROM.
Yesterday, I tried to modify kernel options to include USB_H_HID in the kernel but the build fails on some android.c error.
See you
--
Thus0
Hi Thus0
I did manage to get it to work late last year (Just so you know that it can be done).From memory i basically ran grep over every file in the modules directory looking for CONFIG_USB_GADGET and then edited those files to say something like:
#if defined(CONFIG_USB_ANDROID) || defined(CONFIG_USB_G_ANDROID) || defined(CONFIG_USB_S3C_OTGD)
This way it would compile the USB Gadget modules as well. Let em know if you have any more questions and ill try and help.
Adrian
Huh – is it possible to make apk file for root devices?
Shir_man said:
Huh – is it possible to make apk file for root devices?
Click to expand...
Click to collapse
No sorry, as far as i know a custom kernal is compiled
darcpyro said:
No sorry, as far as i know a custom kernal is compiled
Click to expand...
Click to collapse
Is it possible to only use a driver and to load it with insmod in a stock rom? What modification require a custom kernel?
i was looking for a solution and ou,d something for the nexus 7
https://play.google.com/store/apps/details?id=remote.hid.keyboard.client
open xource here with kernel patch
https://www.google.com/url?q=https:...t&sa=D&usg=AFQjCNGztTd4-U4gHvd4DLzdg_qBxLb7gw
maybe someone can use it
Hi!
I am new to submitting changes to Omnirom. I submitted my first change (see https://gerrit.omnirom.org/#/c/4460) and when reviewing it, I found some places, where I accidentally violated the 'No trailing spaces' rule.
What can I do to correct this?
Should I fix that issue in my sources and supply an other change based on the supplied one or is there a more efficient way to solve this problem?
Kind regards
Uwe
u.k-f said:
Hi!
I am new to submitting changes to Omnirom. I submitted my first change (see https://gerrit.omnirom.org/#/c/4460) and when reviewing it, I found some places, where I accidentally violated the 'No trailing spaces' rule.
What can I do to correct this?
Should I fix that issue in my sources and supply an other change based on the supplied one or is there a more efficient way to solve this problem?
Kind regards
Uwe
Click to expand...
Click to collapse
Repo sync.
Cherry pick your patch.
Make required changes.
In terminal:
git add -A
git commit --amend
Then push the commit. This will create a patch set of same commit.
Sent from my GT-N7100 using Tapatalk
Please excuse my for having a further question:
When I tried to do so I did not succed in pushing my changes:
I tried to
Code:
repo upload
but I got message: 'no branches ready to upload'
and I tried to
Code:
git push
but I got message 'error: The requested URL returned error: 403 Forbidden while accessing https:77github.com/omnirom/android_frameworks_native/info/refs
Do I have to to start a 'repo start' before doing the operation you suggested?
Kind regards and sorry for being a bit helpless...
Uwe
Hmm... That's odd... Are you sure you committed the amend? Or did you maybe accidentally cherrypick the commit onto a branch repo was unaware of? (e.g. one not created with 'repo start')?
I took just the following way:
I abandoned my old change and created a new change without trailing spaces:
https://gerrit.omnirom.org/#/c/4462/
Hope this OK for you...
Kind regards
Uwe
u.k-f said:
I took just the following way:
I abandoned my old change and created a new change without trailing spaces:
https://gerrit.omnirom.org/#/c/4462/
Hope this OK for you...
Kind regards
Uwe
Click to expand...
Click to collapse
OK for this time - but I strongly suggest figuring out how to amend commits in the future.
Hello everyone.
Today I tried to compile my own CM13 build from source, but it just won't go through it.
I followed the guide http://wiki.cyanogenmod.org/w/Build_for_hammerhead completely, except I substituted "cm12.1" for "cm13.0" while initialising the source code. I've got all the required libs and packages, but it always fails at some random point. I don't think any warnings that the compiler is giving are relevant, since it always fails at a different point every time I run it. Any ideas?
Thanks for your replies already!
You could start by showing us some of those errors. Keep in mind that you will need to pass '-j1' to make to get the exact errors.
Hello everyone,
I'm trying to build unofficial los15.1 for my device but I get an error that can be resolved by 'setting ALLOW_MISSING_DEPENDENCIES=TRUE' in enviroment but I don't know how how and where>
Aside from the question if I want to do this, I just want to see how far I come if I do.
Who nows where I have to put this line to solve the issue?
https://github.com/Microsoft/winfile was open source recently, so I built it for rt.
It doesnt ran under WinRT8.1 with same error like WinDjView "number 1566 didn't fnd in the library". Rebuilded new one WinDjView with leaked MFC from VS2001beta works well (with some limitation). Please research this bug. I need an 2window file manager for my RT. How can I help ya?
any chance to get the error as shown in the English ui? would be more familiar to me.
I don't think this project uses mfc.
my guess is some linked dll has an ordinal of 1566 which moved in the dll between rt8.0 and rt8.1. if i get some time I'll recreate the libs from custom def and avoid including ordinal values, so the linker will be forced to load by symbol name.
a note to remind myself how to do that:
lib.exe /def:libfile.def /out:libfile.lib
Please look at there its my opened issue
https://github.com/Microsoft/winfile/issues/6
Unfortunately even when I install English UI some parts of UI still in prenstalled language (Russian in my case) ecen when it sets to English and reboot. This error is still in Russain and Im not sure how it sounds correctly in English.
hooddy said:
Please look at there its my opened issue
https://github.com/Microsoft/winfile/issues/6
Unfortunately even when I install English UI some parts of UI still in prenstalled language (Russian in my case) ecen when it sets to English and reboot. This error is still in Russain and Im not sure how it sounds correctly in English.
Click to expand...
Click to collapse
Privet! Yes, thanks, I am in that github thread also.
Please try this one if you have the time and willingness.
TLDR; Made libs without ordinals to force the system to load libraries and symbols by name. Based upon your error message containing a numerical value and not knowing whether the system will fail if incorrect ordinal or will retry by name.
Steps to produce are different from these: http://www.wanderinghuman.com/blog/archives/000123.html
In addition to that workspace, here's the changes:
Linked without each library individually to see which symbols were used
For each library
created a library.def file with the missing symbols obtained from linked errors
used this command: lib /def:library.def /out:library.lib /MACHINE:ARM
If First time;Observed linker error on resulting library about 0x1c0 (MACHINE:ARM) and remembered that's the Windows CE ARM thumb1
Hex edited library.lib to replace 0x1c0 with 0x1c4 (THUMB2) where relevant
end
Adjusted linker properties to hard code my libraries, so it didn't search default libraries.
Linked and produced what is attached here.
Edit, had typo in a def file, so fixing binary after fixing it/
smb_gaiden said:
any chance to get the error as shown in the English ui? would be more familiar to me.
I don't think this project uses mfc.
my guess is some linked dll has an ordinal of 1566 which moved in the dll between rt8.0 and rt8.1. if i get some time I'll recreate the libs from custom def and avoid including ordinal values, so the linker will be forced to load by symbol name.
a note to remind myself how to do that:
lib.exe /def:libfile.def /out:libfile.lib
Click to expand...
Click to collapse
NEVER LINK WITH ORDINALS, JUST NEVER. That made me lose a metric ton of time reporting stuff which was already ported to RT otherwise. It's a very bad idea, it's worse having builds with ordinals than no builds at all; a fixed version is attached by the way.
Why are you doing it by generating .libs? that's not required anymore, just add the ARM desktop SDK in individual components on VSinstaller
black_blob said:
NEVER LINK WITH ORDINALS, JUST NEVER. That made me lose a metric ton of time reporting stuff which was already ported to RT otherwise. It's a very bad idea, it's worse having builds with ordinals than no builds at all; a fixed version is attached by the way
Click to expand...
Click to collapse
Thanks for the build. I miss some dll to run it. Can ya share it please?
And please share your Far manager build. I really miss them.
smb_gaiden said:
Privet! Yes, thanks, I am in that github thread also.
Please try this one if you have the time and willingness.
TLDR; Made libs without ordinals to force the system to load libraries and symbols by name. Based upon your error message containing a numerical value and not knowing whether the system will fail if incorrect ordinal or will retry by name.
Steps to produce are different from these: http://www.wanderinghuman.com/blog/archives/000123.html
In addition to that workspace, here's the changes:
Linked without each library individually to see which symbols were used
For each library
created a library.def file with the missing symbols obtained from linked errors
used this command: lib /def:library.def /out:library.lib /MACHINE:ARM
If First time;Observed linker error on resulting library about 0x1c0 (MACHINE:ARM) and remembered that's the Windows CE ARM thumb1
Hex edited library.lib to replace 0x1c0 with 0x1c4 (THUMB2) where relevant
end
Adjusted linker properties to hard code my libraries, so it didn't search default libraries.
Linked and produced what is attached here.
Edit, had typo in a def file, so fixing binary after fixing it/
Click to expand...
Click to collapse
Privet! Ill try this new build and it's not workd with the same error as early was. What about all you write there I not really undasttod what can I do for you to improve it Im sorry for my stupidility(((
black_blob
can you tell me more about that please?
hooddy said:
Privet! Ill try this new build and it's not workd with the same error as early was. What about all you write there I not really undasttod what can I do for you to improve it Im sorry for my stupidility(((
Click to expand...
Click to collapse
you'll have to install the ucrt compatibility update
smb_gaiden said:
black_blob
can you tell me more about that please?
Click to expand...
Click to collapse
Windows 10 SDKs for VS2017 have the full set of ARM .libs these days. Set the SDK version to 10.0.16299
black_blob said:
you'll have to install the ucrt compatibility update
Click to expand...
Click to collapse
Where I can get it? Some msu file please. I try to obtain this dll form powershell and dot.net at github with no luck.
@black_blob thank you
@hooddy don't try to understand, just some development information.
smb_gaiden said:
@black_blob thank you
@hooddy don't try to understand, just some development information.
Click to expand...
Click to collapse
I thinks it's an https://support.microsoft.com/en-us/help/3118401/update-for-universal-c-runtime-in-windows I didn't get it over WU. Can ya share direct link for KB3118401 and KB2919355 msu for WinRT please?
Maybe this can help to build proper
https://github.com/Microsoft/winfile/issues/102
Well how about working RT build? Nope?
hooddy said:
Well how about working RT build? Nope?
Click to expand...
Click to collapse
Ended up choosing the nuclear option, and that seems to work alright.
black_blob said:
Ended up choosing the nuclear option, and that seems to work alright.
Click to expand...
Click to collapse
Ya make my day! Thank ya really much!
black_blob said:
Ended up choosing the nuclear option, and that seems to work alright.
Click to expand...
Click to collapse
Oh cool, you saved my future self some time! I ordered a surface RT in order to run 8.1 and leave my main one undisturbed. However, still have some work to do elsewhere, so can you elaborate on the nuclear option in order to save my future self more time? Thank you very much!
Static linking for everything + LTCG + removal of all unused code. It ends up working so well that it has the same size as the binary with outside depends.
I got my new (used) surface rt a few days ago, spent 3 days discovering the service pack update black screen error, installing all the service packs, then using the tool provided by Qiangong et. all.
Reproduced the error with my Winfile and realised that there was one critical library that was being linked with ordinals. Drum roll... kernel32.lib due to not using /NODEFAULTLIBS.
Anyway, it has been corrected and attached is a dynamically linked winfile.exe which runs on Windows RT 8.1. It has already been signed.