Send PS3 commands from non-device?

Discuss everything to do with GIMX here
dr_myslihiiri
Posts: 3
Joined: Wed Jul 23, 2014 6:35 pm

Re: Send PS3 commands from non-device?

Post by dr_myslihiiri »

I'm trying to integrate my Slim PS3 (FW v4.60) with my Raspberry Pi (Debian Wheezy 7.5) using the GIMX 2.02 CLI for home theatre integration purposes. I'm using a BT 2.1 dongle (see the hciconfig output below), which BD address I have successfully changed to match my Sixaxis controller:

Code: Select all

$ sixaddr
Current Bluetooth master: F0:F0:02:xx:xx:xx
Current Bluetooth Device Address: 00:07:04:xx:xx:xx

$ hciconfig -a
hci0:   Type: BR/EDR  Bus: USB
        BD Address: 00:02:72:xx:xx:xx  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING PSCAN
        RX bytes:3070508 acl:52902 sco:0 events:524 errors:0
        TX bytes:7322 acl:177 sco:0 commands:291 errors:0
        Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x79 0x83
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT
        Name: 'raspberrypi-0'
        Class: 0x000508
        Service Classes: Unspecified
        Device Class: Peripheral, Gamepad
        HCI Version: 2.1 (0x4)  Revision: 0x5111
        LMP Version: 2.1 (0x4)  Subversion: 0x420e
        Manufacturer: Broadcom Corporation (15)

$ bdaddr -i hci0
Manufacturer:   Broadcom Corporation (15)
Device address: 00:02:72:xx:xx:xx

$ bdaddr -r -i hci0 00:07:04:xx:xx:xx
Manufacturer:   Broadcom Corporation (15)
Device address: 00:02:72:xx:xx:xx
New BD address: 00:07:04:xx:xx:xx

Address changed - Device reset successully

$ bdaddr -i hci0
Manufacturer:   Broadcom Corporation (15)
Device address: 00:07:04:xx:xx:xx
I can turn on the PS3 from standby by issuing the following command:

Code: Select all

$ gimx --type Sixaxis --bdaddr F0:F0:02:xx:xx:xx
option -t with value `Sixaxis'
option -h with value `0'
option -b with value `F0:F0:02:xx:xx:xx'
using default refresh period: 10.00ms
However, if I try to generate controller events (e.g. PS key down, 50 ms pause, PS key up):

Code: Select all

$ gimx --type Sixaxis --bdaddr F0:F0:02:xx:xx:xx --event 'PS(255)' && sleep 0.5 && gimx --type Sixaxis --bdaddr F0:F0:02:xx:xx:xx --event 'PS(0)'
option -t with value `Sixaxis'
option -b with value `F0:F0:02:xx:xx:xx'
option -e with value `PS(255)'
using default refresh period: 10.00ms
option -t with value `Sixaxis'
option -b with value `F0:F0:02:xx:xx:xx'
option -e with value `PS(0)'
using default refresh period: 10.00ms
Nothing happens on the console. Am I generating the key events correctly? Should GIMX log a response if the event was sent and received successfully?

I'm really not sure about the dongle, either, since I found it on the bottom of a drawer. Should I try a supported CSR bluecore4-rom dongle from the compatibility list instead?

Thanks in advance!
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Send PS3 commands from non-device?

Post by Matlo »

The bluetooth connection takes a lot of time (at least one second) to initialize.
What you should do instead is to run one gimx server that stays connected, and for each command to send fire one gimx client that transmits the command to the server.
This can be done using the "--src IP:port" argument for the server, and the "--dst IP:port" argument for the clients.

http://gimx.fr/wiki/index.php?title=Com ... emote_GIMX
GIMX creator
dr_myslihiiri
Posts: 3
Joined: Wed Jul 23, 2014 6:35 pm

Re: Send PS3 commands from non-device?

Post by dr_myslihiiri »

Matlo wrote:The bluetooth connection takes a lot of time (at least one second) to initialize.
What you should do instead is to run one gimx server that stays connected, and for each command to send fire one gimx client that transmits the command to the server.
This can be done using the "--src IP:port" argument for the server, and the "--dst IP:port" argument for the clients.
Thanks for your quick reply! I started a server with:

Code: Select all

$ sudo gimx --type Sixaxis --bdaddr F0:F0:02:xx:xx:xx --src 127.0.0.1:51914
option -t with value `Sixaxis'
option -b with value `F0:F0:02:xx:xx:xx'
option -s with value `127.0.0.1:51914'
using default refresh period: 10.00ms
This turns on the PS3. I then tried to send the commands by firing off two clients:

Code: Select all

$ gimx --dst 127.0.0.1:51914 --event "PS(255)" && sleep 0.5 && gimx --dst 127.0.0.1:51914 --event "PS(0)"
option -d with value `127.0.0.1:51914'
option -e with value `PS(255)'
Detected controller: none.
using default refresh period: 10.00ms
option -d with value `127.0.0.1:51914'
option -e with value `PS(0)'
Detected controller: none.
using default refresh period: 10.00ms
Unfortunately, these had no effect. Is the Detected controller: none message normal?

The server seems to be listening on 51914/udp:

Code: Select all

$ nc -u -v 127.0.0.1 51914
Connection to 127.0.0.1 51914 port [udp/*] succeeded!
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Send PS3 commands from non-device?

Post by Matlo »

Don't use sudo and put the --bdaddr argument at the end:

Code: Select all

gimx --type Sixaxis --src 127.0.0.1:51914 --bdaddr F0:F0:02:xx:xx:xx
GIMX creator
dr_myslihiiri
Posts: 3
Joined: Wed Jul 23, 2014 6:35 pm

Re: Send PS3 commands from non-device?

Post by dr_myslihiiri »

Matlo wrote:Don't use sudo and put the --bdaddr argument at the end:

Code: Select all

gimx --type Sixaxis --src 127.0.0.1:51914 --bdaddr F0:F0:02:xx:xx:xx
Merci beaucoup! Moving the --bdaddr argument to the end was key (the sudo was a copy-paste error). The integration now works like a charm! Thanks for your help, I'll leave a tip in your PayPal jar.
ImBrian
Posts: 14
Joined: Wed Oct 23, 2013 6:08 am

Re: Send PS3 commands from non-device?

Post by ImBrian »

gimx: error while loading shared libraries: libmhash.so.2: cannot open shared object file: No such file or directory
Does anyone know what package provides this shared lib on Raspbian?

Update: nevermind, had a typo.
ImBrian
Posts: 14
Joined: Wed Oct 23, 2013 6:08 am

Re: Send PS3 commands from non-device?

Post by ImBrian »

Is it possible to have the Gimx service exit after the controller is disconnected? The old emuclient would exit when it became disconnected - and I could subscribe to that event to allow a reconnect. With Gimx 2.x, I see a log in the terminal that reads "sixaxis shutdown", but the process does not terminate.

Thanks,


Brian
ImBrian
Posts: 14
Joined: Wed Oct 23, 2013 6:08 am

Re: Send PS3 commands from non-device?

Post by ImBrian »

I was able to subscribe to the stderr event and force kill the gimx process.
Post Reply