jgeumlek/MoltenGamepad

Chrome and CEF ignore MG's virtual gamepads

TiZ-HugLife opened this issue · 1 comments

Hi there. I've run into an impasse and am not sure what to do next, so I'm reaching out for guidance. I'd like to have a gamepad overlay on my streams and video recordings, and the best tool for the job IMO is the MiniPadder webapp at https://minipadder.link. However, it seems that CEF and Chrome are hellbent on ignoring virtual devices. I'm not sure what I need to do to trick it into looking at it. If I turn off moltengamepad and disable the udev rule that messes with its permissions (actually, I've modified it so that it automatically does nothing if MG isn't running), thus exposing the regular controller, CEF and Chrome pay attention to the gamepad.

I've tried a lot of things to trick Chrome into thinking it's a regular gamepad. The first thing I did is to disable special permission settings and ownership changing on the virtual devices, in case CEF is checking them for shenanigans. It didn't work, but those rules may not even be necessary anyways.

The next thing I tried is create a udev rule and program to create various ENV variables that appear on real controllers: ID_PATH, ID_PATH_TAG, ID_SERIAL (changed from noserial), and even lied about ID_BUS (claimed it's a USB controller).

Aura ~ $ sudo udevadm info -n /dev/input/event27
P: /devices/pci0000:00/0000:00:14.0/usb1/1-14/1-14:1.0/bluetooth/hci0/hci0:256/0005:054C:09CC.0001/input/input33/event27
N: input/event27
L: 0
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-14/1-14:1.0/bluetooth/hci0/hci0:256/0005:054C:09CC.0001/input/input33/event27
E: DEVNAME=/dev/input/event27
E: MAJOR=13
E: MINOR=91
E: SUBSYSTEM=input
E: USEC_INITIALIZED=484529624
E: ID_INPUT=1
E: ID_INPUT_JOYSTICK=1
E: ID_BUS=bluetooth
E: ID_INPUT_JOYSTICK_INTEGRATION=external
E: ID_PATH=pci-0000:00:14.0-usb-0:14:1.0
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_14_1_0
E: ID_FOR_SEAT=input-pci-0000_00_14_0-usb-0_14_1_0
E: LIBINPUT_DEVICE_GROUP=5/54c/9cc:d0:c6:37:d8:b9:99

Aura ~ $ sudo udevadm info -n /dev/input/event10
P: /devices/virtual/input/input18/event10
N: input/event10
L: 0
S: input/by-path/virtual-mg-virtpad1-event-joystick
E: DEVPATH=/devices/virtual/input/input18/event10
E: DEVNAME=/dev/input/event10
E: MAJOR=13
E: MINOR=74
E: SUBSYSTEM=input
E: USEC_INITIALIZED=7745461
E: ID_BUS=usb
E: ID_PATH=virtual-mg-virtpad1
E: ID_PATH_TAG=virtual_mg_virtpad1
E: ID_SERIAL=mg-virtpad1
E: ID_INPUT=1
E: ID_INPUT_JOYSTICK=1
E: ID_INPUT_JOYSTICK_INTEGRATION=internal
E: ID_FOR_SEAT=input-virtual_mg_virtpad1
E: LIBINPUT_DEVICE_GROUP=3/45e/28e:moltengamepad-virtpad1
E: DEVLINKS=/dev/input/by-path/virtual-mg-virtpad1-event-joystick
E: TAGS=:seat:uaccess:

The next thing I tried is patching MG to substitute the slashes in the phys attributes it sets with hyphens, just in case that's breaking something. Again, no dice.

The last thing I tried, which is definitely an extreme measure, is to patch the uinput module itself such that the uniq attribute gets set to the phys attribute whenever phys is set. I patched it by making a super simple DKMS module, and pretty much copied tuxedo_keyboard's homework to make that happen. And it still didn't work.

What's the next step? Is there anything left we can do? Or at this point, should bugs be opened against Chromium/CEF?