containers / bubblewrap

Low-level unprivileged sandboxing tool used by Flatpak and similar projects
Other
3.9k stars 238 forks source link

Binding of joystick inside bubblewrap #591

Closed ruanformigoni closed 1 year ago

ruanformigoni commented 1 year ago

Hi!

I'm having trouble making steam-controller work inside bubblewrap. I've tried to bind:

     _cmd+=("--dev-bind /dev/input /dev/input")
     _cmd+=("--dev-bind /dev/uinput /dev/uinput")
     _cmd+=("--dev-bind /dev/bus/usb /dev/bus/usb")
     _cmd+=("--dev-bind /dev/usb /dev/usb")

And also changed my udev rules, the weird thing is that, it works outside of a game (if I run sc-controller inside bubblewrap, it is correctly detected and configuring it also works). But, through wine it does not.

I tried bind /etc/group, and also create it manually, after starting bubblewrap with --uid and --gid, and adding the input group.

I've found this, which seems to be related, and also used --setenv SDL_JOYSTICK_DISABLE_UDEV 1. That did not work as well.

I also tried this:

--setenv SDL_GAMECONTROLLERCONFIG "030003f05e0400008e02000010010000,Steam Controller,a:b0,b:b1,x:b2,y:b3,back:b6,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,"

Lastly, I tried a full bind of everything to check if something was missing --dev-bind /dev /dev and --bind /run /run, this also did not work.

I think that since it is working in sc-controller, it might be SDL related.

rusty-snake commented 1 year ago

How do you BIND /sys?

Do you unshare-net?

ruanformigoni commented 1 year ago

Hi! Thanks for the reply. The sys was bound with --bind /sys /sys, and unshare-all was in use. I figured it out the issue, the tool https://github.com/meleu/jstest-sdl was installed in the container to verify if the problem was indeed SDL, and it turned out that lib32-sdl was missing 🤦‍♂️ . So I just installed it and that fixed it.