# PPSSPP controller issues



## derschwarzwelt (Feb 16, 2022)

Hello all. I'm on a relatively fresh installation of FreeBSD 13.0 which, to my knowledge, supports PS4 controllers. I've tested Citra and everything works perfectly as far as 3DS emulation is concerned. PSP emulation is a completely different story however. PPSSPP recognises the analogue stick and the face buttons, but the D-Pad doesn't work at all.

Here's what I've done to my /boot/loader.conf


```
ps4dshock_load="YES"
```

I also set up /usr/local/etc/devd/ds4.conf in accordance with the instructions on the RPCS3 wiki page to cover my bases.


```
# DualShock 4
notify 100 {
        match "system"          "USB";
        match "subsystem"       "INTERFACE";
        match "type"            "ATTACH";
        match "vendor" "0x054c";
        match "product" "0x05c4";
        action "chmod 0666 /dev/$cdev";
};

# DualShock 4 Wireless Adapter
notify 100 {
        match "system"          "USB";
        match "subsystem"       "INTERFACE";
        match "type"            "ATTACH";
        match "vendor" "0x054c";
        match "product" "0x0ba0";
        action "chmod 0666 /dev/$cdev";
};

# DualShock 4 Slim
notify 100 {
        match "system"          "USB";
        match "subsystem"       "INTERFACE";
        match "type"            "ATTACH";
        match "vendor" "0x054c";
        match "product" "0x09cc";
        action "chmod 0666 /dev/$cdev";
};
```

I've tried looking for help on the PPSSPP forums, but it looks like it only officially supports Linux. Any ideas as to what might be causing this?


----------



## derschwarzwelt (Feb 16, 2022)

Update: I emailed Wulf and he responded to me this morning. Turns out I missed a few steps that weren't outlined in the man pages or any of the other documentation that I've tried reading. I'll write down the steps he told me to do for anyone else who's having this issue:

1. Add yourself to the "games" group


```
# pw usermod foo -G games
```

2. Add the following to /boot/loader.conf


```
usbhid_load="YES"
hw.usb.usbhid.enable=1
```

3. Add the following to /etc/devfs.rules


```
[system=10]
add path 'input*' mode 0660 group games
```

4. Add the following to /etc/rc.conf


```
devfs_system_ruleset="system"
```

***

Upon rebooting my system, the light on my PS4 controller went from yellow to blue and it was fully supported in both Citra and PPSSPP.

Now if anyone knows how to get an XBox One controller working in FreeBSD 13, please let me know because the xb360gp driver isn't enough in my situation.


----------



## shkhln (Feb 17, 2022)

derschwarzwelt said:


> XBox One controller


multimedia/webcamd


----------



## derschwarzwelt (Feb 19, 2022)

shkhln said:


> multimedia/webcamd



I've enabled webcamd and my Xbox One controller still doesn't work, though `usbconfig` still recognises it. Perhaps I'm missing a step or two, so insight would be greatly appreciated.

EDIT: I emailed Greg, the creator of the xb360gp driver a couple of days ago and he responded. Apparently, the xb360gp driver *does not* support anything other than wired 360 controllers. That's a bit disheartening, but such is life. At any rate, at least my dusty old Logitech F310 is fully functional!


----------



## shkhln (Feb 19, 2022)

Something like this:
`# kldload cuse
# webcamd
Available device(s):
webcamd [-d ugen3.6] -N Microsoft-Controller -S XXXXXXXXXXXX -M 0
# webcamd -N Microsoft-Controller -S XXXXXXXXXXXX -M 0
webcamd 33443 - - Attached to ugen3.6[0]
webcamd 33443 - - Creating /dev/input/event6
webcamd 33443 - - Creating /dev/input/js0`


----------



## shkhln (Feb 19, 2022)

derschwarzwelt said:


> EDIT: I emailed Greg, the creator of the xb360gp driver a couple of days ago and he responded. Apparently, the xb360gp driver *does not* support anything other than wired 360 controllers.


You can submit a HID descriptor for your gamepad if you want, but they look a bit like black magic: https://github.com/freebsd/freebsd-src/commit/0cb0bc8808d00ea6288d6c6a34bd6403597e4327. Also pointless vs direct evdev mapping.


----------



## Vladimir Kondratyev (Feb 21, 2022)

derschwarzwelt said:


> I've enabled webcamd and my Xbox One controller still doesn't work, though `usbconfig` still recognises it. Perhaps I'm missing a step or two, so insight would be greatly appreciated.


Probably, you forgot to add yourself to webcamd group.


----------



## sidetone (Jun 8, 2022)

shkhln said:


> multimedia/webcamd





shkhln said:


> Something like this:
> `# kldload cuse
> # webcamd
> Available device(s):
> ...


I wonder if it works, because it creates and sets the permissions in /usr/local/etc/devd/webcamd.conf.

```
# Generic USB input devices.
notify 100 {
        match "system"          "USB";
        match "subsystem"       "INTERFACE";
        match "type"            "ATTACH";
        match "intclass"        "0x03";
#
# Limit HID device attach to Wacom Devices
# else webcamd might attach to your keyboard
# and mouse
#
        match "vendor"          "0x056a";
        action "/usr/local/etc/rc.d/webcamd start $cdev $interface 2>/dev/null";
};
```


```
# Logitech gamepad
notify 100 {
        match "system"          "USB";
        match "subsystem"       "INTERFACE";
        match "type"            "ATTACH";

        match "vendor"          "0x046d";
        match "product"         "0xc216|0xc219";

        action "/usr/local/etc/rc.d/webcamd start $cdev $interface 2>/dev/null";
};
```
When the permissions are changed, a device can start working. For gamepads, only Logitech is listed in that file, but a Microsoft gamepad is in the example. There may be other ways of calling on a device than the Vendor ID and Product name. I wonder if  `match "intclass"        "0x0e";` sets this. `usbconfig  -d ugen0.#.# -v | egrep -i "(vendor|product|class)"` gives Vendor, Product and Class information.

If webcamd isn't needed for more than a gamepad, I wonder if the gamepad would still work if that config file is copied, devfs is restarted, and webcamd is removed.


----------



## hselasky@ (Jun 9, 2022)

> 4) Optionally add a user to the "webcamd" group
> 
> # pw groupmod webcamd -m <username>


Does this help?


----------



## sidetone (Jun 10, 2022)

I renamed my gamepad.conf and webcamd.conf files, so they wouldn't load.

Then made a devclass.conf file, based off of the one in webcamd.conf:

```
# Generic USB input devices.
notify 100 {
        match "system"          "USB";
        match "subsystem"       "INTERFACE";
        match "type"            "ATTACH";
        match "intclass"        "0x03";
        action "chgrp wheel /dev/$cdev; chmod 660 /dev/$cdev";
};
```
The action was changed from the one from webcamd to this. To test it, I changed the group, to see that it changed to those groups. I believe that `intclass` code is for HID devices.

After `service devd restart`, and reconnecting my gamepad, this set the permission to my HID device gamepad to those groups for testing. My joystick showed output with `joytran`, emulators/joytran.

`usbconfig -d 0.5 -v | grep "03"`

```
bNumInterfaces = 0x0003
    iConfiguration = 0x0004  <RQR24.07_B0030>
    bMaxPower = 0x0031
      bInterfaceClass = 0x0003  <HID device>
        bmAttributes = 0x0003  <INTERRUPT>
      bInterfaceClass = 0x0003  <HID device>
        bmAttributes = 0x0003  <INTERRUPT>
      bInterfaceClass = 0x0003  <HID device>
        bmAttributes = 0x0003  <INTERRUPT>
```
I reconnected another device, a regular wireless USB input device and the group of that changed too, from setting that class.

Here's more: Thread howto-enabling-multimedia-keys-gamepads-joysticks-for-desktop-usbhid.84464.


I'm sure the question was for derschwarzwelt

Webcamd didn't work on mine, but adjusting that setting based on that .conf file, adjusted the permission of it. I tried by installing and trying webcamd, that didn't work, then. I got functionality of a basic gamepad to work in another way, so I'm not trying webcamd.


----------

