ananjaser1211 / Cronos_8890

Exynos8890 Kernel for Galaxy 7 Series | OneUI 1.0/2.5
Other
46 stars 20 forks source link

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

Open Jack-Rickwood opened 4 years ago

Jack-Rickwood commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

@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.

https://github.com/Svirusx/Nethunter-s7-kernel-WirusMOD-AiO/commit/a246ff31ad3998b08107ebcaa370f0acda253244

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

S7 flat, and thanks a bunch!

Jack-Rickwood commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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

ananjaser1211 commented 3 years ago

@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 commented 3 years ago

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.