OS X Workaround for gamepad/joystick hot-plug
#1
Hello,

I've found a workaround to have the gamepad/joystick hot-plug feature in XBMC for Mac OS X. The gamepad hot-plug feature is supported in Windows as Direct X is used, and in Linux as SDL 2.0 is being used now.

That workaround is based on the udev rules workaround used for Linux:
http://forum.kodi.tv/showthread.php?pid=1722549

and launchd and xpc-events for Mac OS X:
http://stackoverflow.com/questions/72401...e-is-conne

I've created the com.xbmc.gamepad_name_hotplug_fix.plist file under /Users/username/Library/LaunchAgents and I've registered to the system using
Code:
launchctl load com.xbmc.gamepad_name_hotplug_fix.plist

I own a Logitech F710 gamepad so in my case:
  • gamepad_name = logitech_f710
  • gamepad_USB_PID = 49689
  • gamepad_USB_VID = 1133

com.xbmc.gamepad_name_hotplug_fix.plist
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.xbmc.gamepad_name_hotplug_fix</string>
    <key>ProgramArguments</key>
    <array>
    <string>/Users/username/Library/LaunchAgents/xbmc_gamepad_name_hotplug_fix.sh</string>
    </array>
    <key>LaunchOnlyOnce</key>
    <true/>
    <key>LaunchEvents</key>
    <dict>
            <key>com.apple.iokit.matching</key>
            <dict>
                    <key>com.apple.device-attach</key>
                    <dict>
                            <key>idProduct</key>
                            <integer>gamepad_USB_PID</integer>
                            <key>idVendor</key>
                            <integer>gamepad_USB_VID</integer>
                            <key>IOProviderClass</key>
                            <string>IOUSBDevice</string>
                            <key>IOMatchLaunchStream</key>
                            <true/>
                    </dict>
            </dict>
    </dict>
</dict>
</plist>

I've enabled the Webserver in XBMC
http://kodi.wiki/view/Settings/Services#Webserver

so this script, when launched, can control remotely XBMC by deactivating and activating the "Enable joystick and gamepad support" option
http://kodi.wiki/view/Settings/System#Input_devices

xbmc_gamepad_name_hotplug_fix.sh
Code:
#!/bin/sh
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:8080/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:8080/jsonrpc
Reply
#2
And this plist should work for the Sony PS3 DualShock 3:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.xbmc.sony_ps3_dualshock3_hotplug_fix</string>
    <key>ProgramArguments</key>
    <array>
    <string>/Users/xxxxxxx/Library/LaunchAgents/xbmc_sony_ps3_dualshock3_hotplug_fix.sh</string>
    </array>
    <key>LaunchOnlyOnce</key>
    <true/>
    <key>LaunchEvents</key>
    <dict>
            <key>com.apple.iokit.matching</key>
            <dict>
                    <key>com.apple.device-attach</key>
                    <dict>
                            <key>IOProviderClass</key>
                            <string>IOBluetoothL2CAPChannel</string>
                            <key>ProductID</key>
                            <integer>616</integer>
                            <key>VendorID</key>
                            <integer>1356</integer>
                    </dict>
            </dict>
    </dict>
</dict>
</plist>
Reply

Logout Mark Read Team Forum Stats Members Help
Workaround for gamepad/joystick hot-plug0