nolirium / aroc

Android root on Chrome OS
GNU General Public License v3.0
129 stars 51 forks source link

uinput module on android subsytem #11

Open netship02 opened 5 years ago

netship02 commented 5 years ago

I know this is not related but i am trying to get this working for days. I am trying to use tincore keymapper but it complains about "uinput" not supported by kernel. I can load (modprobe uinput) from crOS shell but apps still complain. I check in crOs shell /dev/... uinput was there but i if check within android subsytem no "uinput" was there. whole /dev/input folder was empty. Basically android subsytem also does not detect any keyboard or mice.

screenshot 2018-11-22 at 12 41 52 pm

nolirium commented 5 years ago

Yes, I had the same frustration (with Tincore and similar) at one point. It took a lot of messing around before I managed to get it working.

It's been a while (a few CrOS versions) since I was looking into this, but assuming nothing's changed, IIRC to get uinput working in Android, you have to edit /opt/google/containers/android/config.json, adding uinput in as an allowed device with its major/minor numbers etc.

Previously I had added the details in manually (using the existing entries in config.json as a guide), but something like the following (courtesy of the Droidmote author) should also work:

patch_config_json() {
File="/opt/google/containers/android/config.json"
if ! grep -q uinput "$File"; then
  cp $File /opt/google/containers/android/config.json.bak
  awk '{print} /"devices": \[/ && !n {print "{\n\t\t\t\t\"path\": \"/dev/uinput\",\n\t\t\t\t\"type\": \"c\",\n\t\t\t\t\"major\": 10,\n\t\t\t\t\"minor\": 223,\n\t\t\t\t\"fileMode\": 438,\n\t\t\t\t\"uid\": 0,\n\t\t\t\t\"gid\": 0\n\t\t\t},\n\t"; n++}' /opt/google/containers/android/config.json.bak > /opt/google/containers/android/config.json

fi
}
netship02 commented 5 years ago

Thanks for your help! After using your code Tincore not complains about uinput but still there is no input device is detected. I thought when uinput enabled i can create virtual device. how i can add keyboard and mouse so android(Tincore) recognize these devices

chronos@localhost /dev/input $ udevadm info --query=property --name=/dev/input/event6
DEVLINKS=/dev/input/by-path/pci-0000:00:14.0-usb-0:2:1.0-event-kbd /dev/input/by-id/usb-_USB_Keyboard-event-kbd
DEVNAME=/dev/input/event6
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/0003:04D9:1702.0001/input/input7/event6
ID_BUS=usb
ID_INPUT=1
ID_INPUT_KEY=1
ID_INPUT_KEYBOARD=1
ID_MODEL=USB_Keyboard
ID_MODEL_ENC=USB\x20Keyboard
ID_MODEL_ID=1702
ID_PATH=pci-0000:00:14.0-usb-0:2:1.0
ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_0
ID_REVISION=0406
ID_SERIAL=_USB_Keyboard
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030101:030000:
ID_USB_INTERFACE_NUM=00
ID_VENDOR_ENC=\x20
ID_VENDOR_ID=04d9
MAJOR=13
MINOR=70
POWERD_ROLE=external_input
POWERD_TAGS=usable_when_docked usable_when_laptop usable_when_tablet usable_when_display_off role_external_input
POWERD_TAGS_USABLE=usable_when_docked usable_when_laptop usable_when_tablet usable_when_display_off
SUBSYSTEM=input
TAGS=:powerd:
USEC_INITIALIZED=13299880
chronos@localhost /dev/input $ udevadm info --query=property --name=/dev/input/event7
DEVLINKS=/dev/input/by-id/usb-_USB_Keyboard-event-if01 /dev/input/by-path/pci-0000:00:14.0-usb-0:2:1.1-event
DEVNAME=/dev/input/event7
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.1/0003:04D9:1702.0002/input/input8/event7
ID_BUS=usb
ID_INPUT=1
ID_INPUT_KEY=1
ID_MODEL=USB_Keyboard
ID_MODEL_ENC=USB\x20Keyboard
ID_MODEL_ID=1702
ID_PATH=pci-0000:00:14.0-usb-0:2:1.1
ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_1
ID_REVISION=0406
ID_SERIAL=_USB_Keyboard
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030101:030000:
ID_USB_INTERFACE_NUM=01
ID_VENDOR_ENC=\x20
ID_VENDOR_ID=04d9
MAJOR=13
MINOR=71
POWERD_ROLE=external_input
POWERD_TAGS=usable_when_docked usable_when_laptop usable_when_tablet usable_when_display_off role_external_input
POWERD_TAGS_USABLE=usable_when_docked usable_when_laptop usable_when_tablet usable_when_display_off
SUBSYSTEM=input
TAGS=:powerd:
USEC_INITIALIZED=13338129
chronos@localhost /dev/input $ udevadm info --query=property --name=/dev/input/event8
DEVLINKS=/dev/input/by-id/usb-0000_USB_OPTICAL_MOUSE-event-mouse /dev/input/by-path/pci-0000:00:14.0-usb-0:3:1.0-event-mouse
DEVNAME=/dev/input/event8
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.0/0003:0000:0538.0003/input/input9/event8
ID_BUS=usb
ID_INPUT=1
ID_INPUT_MOUSE=1
ID_MODEL=USB_OPTICAL_MOUSE
ID_MODEL_ENC=\x20USB\x20OPTICAL\x20MOUSE
ID_MODEL_ID=0538
ID_PATH=pci-0000:00:14.0-usb-0:3:1.0
ID_PATH_TAG=pci-0000_00_14_0-usb-0_3_1_0
ID_REVISION=0100
ID_SERIAL=0000_USB_OPTICAL_MOUSE
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030102:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=0000
ID_VENDOR_ENC=0000
ID_VENDOR_ID=0000
MAJOR=13
MINOR=72
POWERD_ROLE=external_input
POWERD_TAGS=usable_when_docked usable_when_laptop usable_when_tablet usable_when_display_off role_external_input
POWERD_TAGS_USABLE=usable_when_docked usable_when_laptop usable_when_tablet usable_when_display_off
SUBSYSTEM=input
TAGS=:powerd:
USEC_INITIALIZED=13333306

screenshot 2018-11-23 at 10 54 27 am

Also did you tried octopus keymapper it is working good except during mouse movement mouse pointer stuck(bounce) at every edge of screen.

Link for octopus which work with x86 and x64 : https://drive.google.com/file/d/189ci9sjGZQZExmXm17h_nMINclKI_yrV/view http://bbs.phoenixstudio.org/en/showthread.php?tid=14911