Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use quotes or spaces correctly in /etc/default/xboxdrv #52

Open
geekycow opened this issue Jan 1, 2016 · 13 comments
Open

Can't use quotes or spaces correctly in /etc/default/xboxdrv #52

geekycow opened this issue Jan 1, 2016 · 13 comments

Comments

@geekycow
Copy link

geekycow commented Jan 1, 2016

Hiya :)

I was trying to add the option --device-name="Xbox 360 Wireless Receiver (XBOX)" to the options in /etc/default/xboxdrv in order to get xboxdrv to properly emulate xpad device names but came across an issue whereby it doesn't seem to be possible to give commands with spaces or quotes in the arguments in any of the options in this file. All attempts to use normal bash style escaping fail.

Examples that don't work...

...=--device-name="Xbox 360 Wireless Receiver (XBOX)"
...=--device-name=Xbox 360 Wireless Receiver (XBOX)
...=--device-name='Xbox 360 Wireless Receiver (XBOX)'
...="--device-name="Xbox 360 Wireless Receiver (XBOX)""
...="--device-name='Xbox 360 Wireless Receiver (XBOX)'"
...='--device-name="Xbox 360 Wireless Receiver (XBOX)"'
etc

(also tried without the '()'s in case they were upsetting something)

All attempts either result in the option being truncated (so the device name becomes just Xbox and not Xbox 360 Wireless....) or the escape or quote characters get included and it still gets truncated (with the device name still being truncated, i.e. Xbox\ "Xbox 'Xbox and so on.)

I'm guessing /etc/init.d/xboxdrv gets processed by system.d or similar and that this might be a systemd shell related issue.

If it's not possible to get around this problem, why not either-

  • (Messy) Add another variable to /etc/default/xboxdrv that is parsed by /etc/init.d/xboxdrv, e.g. DEVICE_NAME

Or-

  • (Neater) Give up on importing command line arguments from /etc/default/xboxdrv and use it as a regular xboxdrv configuration file instead?

Regards
Julie
x

@mainmachine
Copy link
Collaborator

I would expect you'd have to use escape before each whitespace, as in:

...=--device-name="Xbox\ 360\ Wireless\ Receiver\ (XBOX)"

I can't test this at the moment - could someone else test it...?

@geekycow
Copy link
Author

geekycow commented Jan 4, 2016

I believe that's one of the many combinations I tried (including numbered version of the escape code for space, to avoid using a real space after all.)

@mainmachine
Copy link
Collaborator

what does your uxvars looks like with any of the above lines you tried?

cat usr/share/ubuntu-xboxdrv/uxvars

@mainmachine
Copy link
Collaborator

I think I might have the solution, and it looks like a systemd whitespace handling issue. I've updated my fork to look like this:
${XBOXDRV_OPTIONS} ${PAD_OPTIONS}
The brackets will cause systemd to parse whitespace properly.

I won't be able to test this until this weekend, but if you'd like to try it you can clone my fork and try it: https://github.com/mainmachine/ubuntu_xboxdrv

@geekycow
Copy link
Author

geekycow commented Jan 4, 2016

I looked up what I could on Systemd variable parsing and already tried exactly that before I submitted the bug report. :( I spent a good few hours going slowly insane trying to find a work around. :(

@mainmachine
Copy link
Collaborator

hmmm... just read your other issue report - you're on Trusty?

IIRC Trusty uses Upstart by default; It'll only use Systemd if you set it to do that - are you actually using Systemd? If not then we should look at the /etc/init/xboxdrv.conf and how those *_OPTIONS are handled there...

@geekycow
Copy link
Author

geekycow commented Jan 4, 2016

Doh! Of course, you're right. I can't tell you what an idiot I feel for blaming systemd now. ;) In my defence it's because I'm on 15.10 on my main box and on jessie on my Pi (which is systemd too.)

From my heart: sorry! :)

This Trusty box is "relatively" unhackedaboutwith, so I wouldn't have moved to systemd. So can't be systemd'isms then!

Tomorrow in the morning I can reinstall the package on the Trusty box and get the same bug up to continue supplying info.

From memory, other than $PAD_OPTIONS, I believe xboxdrv.conf just imports most of the relevant variables and uses them in the xboxdrv command line as just $VARIABLE rather than ${VARIABLE} or "$VARIABLE" (I tried the later two variations too.)

Additionally, again from memory, for it to make a change to the device name, I think the --device-name option actually needs to be in the $CONTROLLER#_OPTIONS variables - I just gave the above as a rough example of the difficult in escaping/quoting variables with embedded spaces.

Sorry again for leading you down the wrong path re systemd!

@mainmachine
Copy link
Collaborator

Heh, don't beat yourself up too much for it! 😉

I typically run 14.04 (or current LTS) on servers and 15.10 (or latest) on desktop machines. Aside from systemd, the only major difference that I've had to keep an eye on is Kernel updates.

I'll update the Upstart service to use the bracketed variables. It shouldn't break anything, and might fix the problem you reported.

@raelgc
Copy link
Owner

raelgc commented Jan 13, 2016

Hi @mainmachine, thanks for all help here!

And I like your improvements in your fork to support blank spaces and quotes.

Do you mind to create a pull request to send back your improvements and fix this issue on systemd?

@mainmachine
Copy link
Collaborator

I haven't had a chance to test it yet, but if you (or someone else) have done so (or if you're willing to roll the dice ;) ), then certainly!

I am fairly certain that at a bare minimum it won't break anything, and I'm hoping it might resolve some issues I've been seeing in some games with my wireless xbox360 pads.

@mainmachine
Copy link
Collaborator

I was able to test my changes, and unfortunately systemd does not like this:

${VARIABLE}

It will appear to work, but if you do a

sudo service xboxdrv status

It complains about not understanding one of the options. Sorry about the lack of detail, but I'm going from memory. Suffice it to say it needs a little more work. :/

@raelgc
Copy link
Owner

raelgc commented Jan 19, 2016

Thank you for all testing and feedback, @mainmachine!

@geekycow
Copy link
Author

Sorry for delay, guys.

I also tried ${VARIABLE} on a non-systemd system when I was trying to this to work and it also didn't help the problem, sorry.

I still think the right way to do this would be using a regular xboxdrv config file but I suspect that would break compatibility with installations already out there. :(

xxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants