(2014-05-29, 09:43)teeedubb Wrote: /etc/udev/rules.d/99-joysticks.rules
Code:
ACTION=="add", KERNEL=="js*", DRIVERS=="xpad", RUN+="/usr/bin/.scripts/xbmc-xbox360-pad-fix.sh"
xbmc-xbox360-pad-fix.sh
Code:
#!/bin/bash
curl -v -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"input.enablejoystick","value":false},"id":1}' http://localhost:9191/jsonrpc
sleep 1
curl -v -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"input.enablejoystick","value":true},"id":1}' http://localhost:9191/jsonrpc
Make xbmc-xbox360-pad-fix.sh executable with the chmod +x command.
Your suggestion was very helpful, great idea!
But for reasons I don't understand it didn't work as it should. Using curl to POST to the json server I consistently got 400: Bad Request. Using wget it worked from other hosts but not from localhost. When I tried running it with strace to see what was going on it worked perfectly :S
I know, very weird. probably some timing issue. I've been at it for over an hour and came out empty handed.
What I ended up doing is connect to the http server and send the request as a GET, here's my version of your
xbmc-xbox360-pad-fix.sh:
Code:
#!/bin/sh
wget -O- -q 'http://<USER>:<PASSWORD>@localhost:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"input.enablejoystick","value":false},"id":1}'
sleep 1
wget -O- -q 'http://<USER>:<PASSWORD>@localhost:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"input.enablejoystick","value":true},"id":1}'
FTR, my curl version is:
Code:
curl --version
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
And I'm running xbmcbuntu gotham with all packages up to date.