pelya / android-keyboard-gadget

Convert your Android device into USB keyboard/mouse, control your PC from your Android device remotely, including BIOS/bootloader.
Apache License 2.0
1.25k stars 314 forks source link

Nexus 10 Patch #6

Closed binkybear closed 10 years ago

binkybear commented 10 years ago

I'm trying to compile for the Nexus 10 and the patch for 3.4 works mostly fine except:

Here is the source file for reference:

https://android.googlesource.com/kernel/exynos.git/+/android-exynos-manta-3.4-kitkat-mr2/drivers/usb/gadget/android.c

I know there isn't a conf in this android.c so I tried replacing with 'name' but it still doesn't seem to want to build. Any help would be much appreciated.

pelya commented 10 years ago

I've added Nexus 10 patch - it compiles, but I cannot test it: https://github.com/pelya/android-keyboard-gadget/blob/master/not-tested/kernel-3.4-nexus10-2012.patch

On Tue, Aug 12, 2014 at 10:33 AM, binkybear notifications@github.com wrote:

I'm trying to compile for the Nexus 10 and the patch for 3.4 works mostly fine except:

  • if (hid_enabled)
  • android_enable_function(dev, conf, "hid");

Here is the source file for reference:

https://android.googlesource.com/kernel/exynos.git/+/android-exynos-manta-3.4-kitkat-mr2/drivers/usb/gadget/android.c

I know there isn't a conf in this android.c so I tried replacing with 'name' but it still doesn't seem to want to build. Any help would be much appreciated.

— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/6.

binkybear commented 10 years ago

pelya - Thanks for the quick patch and the kernel built/compiled fine. Flashed the kernel and I tried running the usb android app and I only get instructions to build the custom kernel. I added the /dev/hid* in ueventd.rc manually and killed ueventd (so that it restarted) and still nothing.

Tried a dmesg | grep hid but that didn't return anything so I don't have any debugging.

pelya commented 10 years ago

If /dev/hidg0 and hidg1 exists, you only need to set appropriate permissions to them, like world-writable. The app will try to change permissions on start, using superuser command. Do you have a proper su command installed, that will work for apps? On Aug 13, 2014 7:58 AM, "binkybear" notifications@github.com wrote:

pelya - Thanks for the quick patch and the kernel built/compiled fine. Flashed the kernel and I tried running the usb android app and I only get instructions to build the custom kernel. I added the /dev/hid* in ueventd.rc manually and killed ueventd (so that it restarted) and still nothing.

— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/6#issuecomment-52009915 .

binkybear commented 10 years ago

I don't have either hidg0 or hidg2 in /dev. Su works but USB Keyboard is not even asking for root permissions.

pelya commented 10 years ago

That means the kernel does not contain the patch - these files should be created whenever you plug your phone into PC.

I suggest to ask the maintainer of that kernel, maybe he forgot to put it into some of the versions:

http://forum.xda-developers.com/showthread.php?t=2725023 On Aug 14, 2014 3:25 AM, "binkybear" notifications@github.com wrote:

I don't have either hidg0 or hidg2 in /dev. Su works but USB Keyboard is not even asking for root permissions.

— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/6#issuecomment-52129885 .

binkybear commented 10 years ago

Pelya,

Thanks for all your help. I'm compiling the kernel myself and your patched have worked well when I've built them on the Nexus 7 and Nexus 5. I'm still not sure what the issue is, but I'll keep trying at it. Thanks again for your quick responses and I'll let you know if I ever get it working.

binkybear commented 10 years ago

Pelya,

I was able to get the keyboard to show up on the n10 by modifying your patch with:

    err = android_enable_function(dev, name);
    if (err)
        pr_err("android_usb: Cannot enable '%s' (%d)",
                           name, err);
    if (!strcmp(name, "hid"))
        hid_enabled = 1;

        /* HID driver always enabled, it's the whole point of this kernel patch */
            android_enable_function(dev, "hid");
}

mutex_unlock(&dev->mutex);