chrippa / ds4drv

A Sony DualShock 4 userspace driver for Linux
MIT License
1.05k stars 213 forks source link

systemd issue #16

Closed benmoran56 closed 10 years ago

benmoran56 commented 10 years ago

I'm not very familar with systemd, so please close this if appropriate. ds4drv.service often fails to start, despite having the proper bluetooth dependencies in the .service file. I'm not sure whats causing it, but I was able to get it working by changing the Restart=on-abort to Restart=on-failure

I know it shouldn't have to restart at all, so this is not really a fix. I was thinking maybe there is something else that needs to start before ds4drv.service can load correctly, but I'm not completely sure how to figure out what.

chrippa commented 10 years ago

What is the output of systemctl status ds4drv (run as root to see full log output) when it has failed to start?

benmoran56 commented 10 years ago

Ah, I didn't know running as root would show additional output. I changed back to Restart=on-abort, and restarted the machine. It failed to start on boot, and had this in the log:

systemd[1]: Starting ds4drv daemon... systemd[1]: Started ds4drv daemon. ds4drv[451]: [error][daemon] 'hcitool clock' returned error. Make sure your bluetooth device is Powered up with 'hciconfig hciX up'. systemd[1]: ds4drv.service: main process exited, code=exited, status=1/FAILURE systemd[1]: Unit ds4drv.service entered failed state.

It looks to be caused by my bluetooth adapter, which is an Atheros AR3011. It's built in on my motherboard, but shows up under lsusb so it should be a standard USB bus device. This is odd that the ds4drv.service is failing, since the bluetooth dependencies in the service file should make it start only after bluetooth, right? I wonder if this is something specific to my bluetooth adapter, or if anyone else has issues.

chrippa commented 10 years ago

Hmm, I think using WantedBy=bluetooth.target is actually wrong and might cause issues. Try changing the last line to WantedBy=multi-user.target and then re-install the service with systemctl disable ds4drv and systemctl enable ds4drv.

benmoran56 commented 10 years ago

Unfortunately that didn't have any effect - it still failed. I wonder if anyone else has issues with the service file, or just me. I have a fairly typical Arch install, so I'm not sure..

benmoran56 commented 10 years ago

Just an update: with the recent version, this problem seems to be gone now. I've tested with the default ds4drv.service file, and the daemon always loads reliably on PC start. My PC hardware (or other daemons) have not changed, so I'm not sure what the resolution was, unfortunately. I think maybe it's best to close this bug, since noone else has reported any issues.

benmoran56 commented 10 years ago

This was still occuring for me in raw mode (hidraw mode was OK), but I finally figured it out. My bluetooth adapter was talking too long to power on. I solved it by creating a udev rule for my adapter, as per the Arch wiki. I created a "/etc/udev/rules.d/10-local.rules" file like this: ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"

In case anyone else has this trouble.