Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Enable the HID function in the USB gadget driver #3

Open
Jack-Rickwood opened this issue Sep 5, 2020 · 13 comments
Open

[Feature] Enable the HID function in the USB gadget driver #3

Jack-Rickwood opened this issue Sep 5, 2020 · 13 comments

Comments

@Jack-Rickwood
Copy link

In /drivers/usb/gadget/function/ the f_hid function seems to exist, but it isn't working on my phone. I think this is because it isn't enabled in the makefile/KConfig or something, and was wondering if this could be included in the kernel?

@SypeR54
Copy link

SypeR54 commented Sep 5, 2020

@Jack-Rickwood In "drivers/../../function" Makefile, f_hid.o not presented. So USB HID feature skipped. However, USB HID skipped on official N935 kernel source too.

Thanks for noticing. 😊

@Jack-Rickwood
Copy link
Author

Np. Not sure if it helps, but this kernel seems to include it: https://github.com/Svirusx/Nethunter-s7-kernel-WirusMOD-AiO (the file is there for me when I flash it).

@SypeR54
Copy link

SypeR54 commented Sep 5, 2020

@Jack-Rickwood "usb_f_hid-y := f_hid.oobj-$(CONFIG_USB_G_ANDROID) += usb_f_hid.o"

This strings added in Makefile and also there is bunch of edits too.

Svirusx/EOL-Nethunter-s7-kernel-WirusMOD-AiO@a246ff3

Thanks again for finding.

However, Kali kernel works for pure distro. I'm not sure all of the commits works directly on Samsung Q without broke any feature.

@Jack-Rickwood
Copy link
Author

Yeah idk either. If it's not an easy thing to do, this can be closed i think. I just opened this in case it was a super quick one line fix or something.

@ananjaser1211
Copy link
Owner

I think I've seen commits that does this. I don't know the use case but I'll take a look and let you know

@Jack-Rickwood
Copy link
Author

Thanks! My use case is that there is a certain app that checks if you have a specific controller connected, and the way it checks is by matching the product name (which I can already spoof), and interface class code. The interface class for HID devices is 0x03, and I want my phone to report as that over usb. I don't even need it to be able to send inputs over. Not really the end of the world if I cant do that, but I opened this issue just in case.

@ananjaser1211 ananjaser1211 changed the title Would it be possible to enable the HID function in the USB gadget driver? [Feature] Enable the HID function in the USB gadget driver Sep 5, 2020
@ananjaser1211
Copy link
Owner

Thanks! My use case is that there is a certain app that checks if you have a specific controller connected, and the way it checks is by matching the product name (which I can already spoof), and interface class code. The interface class for HID devices is 0x03, and I want my phone to report as that over usb. I don't even need it to be able to send inputs over. Not really the end of the world if I cant do that, but I opened this issue just in case.

Alright thanks for the info, are you on S7 Flat or edge?

i will add it and send you a test image once i have the chance

@Jack-Rickwood
Copy link
Author

S7 flat, and thanks a bunch!

@Jack-Rickwood
Copy link
Author

Jack-Rickwood commented Nov 13, 2020

@ananjaser1211 Not really relevant to this issue, but I didn't think it was worth making another one. Do you know what I'm doing wrong when trying to build the kernel?
I clone a slightly older version of gcc, clone this kernel, then run:

export CROSS_COMPILE=(pathtogcc)
export ARCH=arm64
export SUBARCH=arm64
export ANDROID_MAJOR_VERSION=q
export PLATFORM_VERSION=10.0.0
export ANDROID_VERSION=100000
export CURRENT_ANDROID_MAJOR_VERSION=q
make clean
make mrproper
make exynos8890_defconfig cronos_defconfig hero_defconfig oneui_defconfig
make -j$(nproc --all)

And then it compiles for a while before failing on:
macro "exynos_ss_panic_handler_safe" passed 1 arguments, but takes just 0
Any idea what it could be?

@ananjaser1211
Copy link
Owner

@ananjaser1211 Not really relevant to this issue, but I didn't think it was worth making another one. Do you know what I'm doing wrong when trying to build the kernel?
I clone a slightly older version of gcc, clone this kernel, then run:

export CROSS_COMPILE=(pathtogcc)
export ARCH=arm64
export SUBARCH=arm64
export ANDROID_MAJOR_VERSION=q
export PLATFORM_VERSION=10.0.0
export ANDROID_VERSION=100000
export CURRENT_ANDROID_MAJOR_VERSION=q
make clean
make mrproper
make exynos8890_defconfig cronos_defconfig hero_defconfig oneui_defconfig
make -j$(nproc --all)

And then it compiles for a while before failing on:
macro "exynos_ss_panic_handler_safe" passed 1 arguments, but takes just 0
Any idea what it could be?

Use the included build script to compile this kernel. i dont think make *_Defconfig works, the script will cat each config into one tmp_defconfig and then make that instead
cuz it sounds like some configs were not enabled / disabled.

and regardless of what ROM you are targeting,

export ANDROID_MAJOR_VERSION=q
export PLATFORM_VERSION=10.0.0
export ANDROID_VERSION=100000

this is invalid, it needs to be

export ANDROID_MAJOR_VERSION=p
export PLATFORM_VERSION=9.0.0

@Jack-Rickwood
Copy link
Author

@ananjaser1211 Lol, didn't see the build script - that would have saved me a lot of headaches! Works perfectly now, thanks!

@ananjaser1211
Copy link
Owner

@ananjaser1211 Lol, didn't see the build script - that would have saved me a lot of headaches! Works perfectly now, thanks!

Most welcome mate.

@Jack-Rickwood
Copy link
Author

Jack-Rickwood commented Jan 20, 2021

I tried applying the commits affecting the file in question from "https://github.com/Svirusx/Nethunter-s7-kernel-WirusMOD-AiO" to this kernel and the hid function appears to work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants