[HOWTO] From command line

Need help? Ask here and someone will help
Post Reply
lzap
Posts: 12
Joined: Wed Oct 05, 2011 5:12 pm

[HOWTO] From command line

Post by lzap »

I would *love* to get this working from my command line. Can you please help me and correct everything I am doing wrong please?

This tutorial is for SVN version of GIMX.

- my PS3 is turned off
- I connect my paired sixaxis controller to the USB port (it starts charging)

Code: Select all

sixaddr
Current Bluetooth master: AA:AA:AA:AA:AA:AA
Current Bluetooth Device Address: BB:BB:BB:BB:BB:BB
So AA:AA:AA:AA:AA:AA is the PS3 address and BB:BB:BB:BB:BB:BB is sixaxis addres. Now you can disconnect the controller, do not turn it on, keep it turned off! PS3 is also turned off. You will need to know controller number (LED that is shown on it - usually 1).

Now connect your BT dongle, if you have a notebook you need to turn on its bluetooth because if you turn it off most Linux distributions unloads modules from the kernel. I recommend to do "hciconfig" command and to write down your notebook BD address just in case you make a mistake and overwrite it (just like I did).

Plug your BT dongle and do hciconfig again:

Code: Select all

hciconfig 
hci0:	Type: BR/EDR  Bus: USB
	BD Address: XX:XX:XX:XX:XX:XX  ACL MTU: 310:10  SCO MTU: 64:8
	UP RUNNING PSCAN 
	RX bytes:1127 acl:0 sco:0 events:37 errors:0
	TX bytes:664 acl:0 sco:0 commands:32 errors:0

hci1:	Type: BR/EDR  Bus: USB
	BD Address: YY:YY:YY:YY:YY:YY  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING PSCAN ISCAN 
	RX bytes:1155 acl:0 sco:0 events:42 errors:0
	TX bytes:918 acl:0 sco:0 commands:42 errors:0
So in my case the BT dongle address is XX:XX:XX:XX:XX:XX because the other address was there when BT was disconnected. As you can see its device id is "hci0" and number is 0. Quite unusual (I would expect it to be hci1 but this is my case).

Now write down your XX:XX:XX:XX:XX:XX address and do not lost it, you will need it to recover the dongle back after you finish using GIMX. Overwrite the address now:

Code: Select all

sudo ./bdaddr -i hci0 BB:BB:BB:BB:BB:BB
Manufacturer:   Cambridge Silicon Radio (10)
Device address: XX:XX:XX:XX:XX:XX
New BD address: BB:BB:BB:BB:BB:BB
Few remarks. hci0 is your device, BB is your sixaxis controller number. And you need to be root for that. Disconnect it, reconnect after that and check the "hciconfig" again to see if everything works.

If you run into problems when changing address you need to try different BT dongle, see FAQ and other posts here. I also recommend to include information about your BT dongle with the following command:

Code: Select all

hciconfig hci0 revision
hci0:	Type: BR/EDR  Bus: USB
	BD Address: BB:BB:BB:BB:BB:BB  ACL MTU: 310:10  SCO MTU: 64:8
	Unified 21e
	Chip version: BlueCore4-ROM
	Max key size: 128 bit
	SCO mapping:  HCI
Now, when PS3 is still turned off, do this:

Code: Select all

emu AA:AA:AA:AA:AA:AA 0 0
connecting with hci0 = BB:BB:BB:BB:BB:BB to AA:AA:AA:AA:AA:AA psm 17
connecting with hci0 = BB:BB:BB:BB:BB:BB to AA:AA:AA:AA:AA:AA psm 19
connected
You found AA and BB addresses above, 0 is your device number (hci0 = 0, hci1 = 1 etc) and the last parameter is your controller number (0 for controller 1, 1 for 2 etc - the LED you determined above). Now even when PS3 is turned off (in standby mode), it should connect. If not, remove the BT dongle and try the controller you used to turn it on. If it does not work, you need to re-pair it and do everything again - make sure you turn it off when trying BT dongle. If controller works, turn it off and try again.

Now you are ready to prepare configuration using nice GIMX tools, I will use one from example directory which is great:

Code: Select all

emuclient --status --force-updates --subpos --config BattlefieldBadCompany2.xml
Please note emuclient loads configuration from ~/.emuclient/config directory on Linux, make sure you have it there. Small black window opens, you can try if it works - in this case PS button is mapped to right shift, arrows to ASDW and buttons to ERF.

You should be able to use PS3 using BT dongle. Unfortunately I am having terrible lag issues with Fedora.
Last edited by lzap on Sun Mar 04, 2012 11:32 am, edited 2 times in total.
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: [HOWTO] From command line

Post by Matlo »

Your ps3 has to be in standby (red light on).
And your sixaxis has to be a genuine one.

The right command syntax is:

Code: Select all

emu <ps3-mac-address>  <bt device number> <sixaxis number> 
GIMX creator
lzap
Posts: 12
Joined: Wed Oct 05, 2011 5:12 pm

Re: [HOWTO] From command line

Post by lzap »

When I turn on my PS3 it finally connects. But I have some troubles with emuclient (its loading configuration files from wrong paths). After some patching it finally loads the example BadCompany2 xml file, but pressing RSHIFT does not anything, keys does not work.

Do you have some debug script or something I could try to "send" to the emu server just to see if the server is working and I have only problematic emuclient?
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: [HOWTO] From command line

Post by Matlo »

I think there is a problem with config paths in the code you checked out. It should be fixed in the latest code version.

The syntax for emuclient is:

Code: Select all

emuclient --force-updates --subpos --config <file.xml>
If you want to see what commands are sent, just add " --status" at the end of the command.
GIMX creator
lzap
Posts: 12
Joined: Wed Oct 05, 2011 5:12 pm

Re: [HOWTO] From command line

Post by lzap »

Yes, now it loads the configuration correctly, also it connects and after restart I am also to connect to PS3 in standby (for some reason the sixaxis was unpaired - I had to do something wrong last time). So now I have emu connected and I can also see emuclient is sending correct keys now. Unfortunately my PS3 does not turn on, there is something missing.

Please note I am using Fedora 64bit and SVN version, I did not do make install, I copied everything to one directory along with sdl library and changed LD_LIBRARY_PATH. I think I only miss one bit - I am very close!

Code: Select all

connected to emu 0
0 1330775261.408906 controller 0 is switched from configuration 0 to 0
1 1330775261.408938 controller 1 is switched from configuration 0 to 0
2 1330775261.408947 controller 2 is switched from configuration 0 to 0
3 1330775261.408953 controller 3 is switched from configuration 0 to 0
4 1330775261.408959 controller 4 is switched from configuration 0 to 0
5 1330775261.408968 controller 5 is switched from configuration 0 to 0
6 1330775261.408977 controller 6 is switched from configuration 0 to 0
0 1330775261.409042 N b0 . .... ? { 00 00 } axis (0,0) (127,127) acc (0,0,0,0)
0 1330775261.418043 N b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0)
0 1330775262.881572 N b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0) ps-ff
0 1330775263.002669 N b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0)
0 1330775263.588407 N b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0) ps-ff
0 1330775263.759877 N b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0)
0 1330775265.335109 N b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0) triangle-ff
0 1330775265.415809 N b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0)
0 1330775266.839268 N b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0) square-ff
0 1330775266.930136 N b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0)
Is there enything I could check, look for or try? I did set debug to 2 in the emu and it looks like it is getting all events:

Code: Select all

1330776297.634401     PS3 input   01: 00 00 80 00 00 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 03 05 16 00 00 00 00 33 02 77 01 9e 02 00 02 00 02 00 02 00
0 1330776297.634435 R b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0) square-ff
1330776297.634447 Sixaxis input   01: 00 00 80 00 00 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 03 05 16 00 00 00 00 33 02 77 01 9e 02 00 02 00 02 00 02 00
non blocking send took: 35 µs
1330776297.644504     PS3 input   01: 00 00 80 00 00 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 03 05 16 00 00 00 00 33 02 77 01 9e 02 00 02 00 02 00 02 00
0 1330776297.644535 R b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0) square-ff
1330776297.644546 Sixaxis input   01: 00 00 80 00 00 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 03 05 16 00 00 00 00 33 02 77 01 9e 02 00 02 00 02 00 02 00
If I succeed I am going to create RPMs for Fedora ;-)
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: [HOWTO] From command line

Post by Matlo »

What's displayed when emu starts?

Did you tried alien?

EDIT: I also can't get the latest code to work. There seems to be a regression somewhere. I will try to fix that ASAP.

EDIT2: Fixed.
GIMX creator
lzap
Posts: 12
Joined: Wed Oct 05, 2011 5:12 pm

Re: [HOWTO] From command line

Post by lzap »

Updated, emu and emuclient rebuilt and it did not help :-(

Code: Select all

connecting with hci0 = 00:26:43:XX:XX:16 to 78:dd:08:xx:xx:b1 psm 17
connecting with hci0 = 00:26:43:XX:XX:16 to 78:dd:08:b0:xx:xx psm 19
connected
0 1330853219.260518 N b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0)
1330853219.262838     PS3 feature f4: 42 03 00 00
0 1330853220.260604 R b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0)
1330853220.260638 Sixaxis input   01: 00 00 00 00 00 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 05 16 00 00 00 00 33 02 77 01 9e 02 00 02 00 02 00 02 00
non blocking send took: 57 µs
0 1330853221.260766 R b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0)
1330853221.260799 Sixaxis input   01: 00 00 00 00 00 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 05 16 00 00 00 00 33 02 77 01 9e 02 00 02 00 02 00 02 00
non blocking send took: 51 µs
0 1330853222.260928 R b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0)
1330853222.260957 Sixaxis input   01: 00 00 00 00 00 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 05 16 00 00 00 00 33 02 77 01 9e 02 00 02 00 02 00 02 00
non blocking send took: 49 µs
0 1330853223.261036 R b0 . .... ? { 00 00 } axis (0,0) (0,0) acc (0,0,0,0)
1330853223.261062 Sixaxis input   01: 00 00 00 00 00 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 05 16 00 00 00 00 33 02 77 01 9e 02 00 02 00 02 00 02 00
non blocking send took: 39 µs
Those tools like aliend cannot help much often - two distros has two versions of libraries. And its easier for me to create a package, the only issue is libsdl patch - according to the Fedora guidelines I am not allowed to distribute dynamic libraries.

Edit: By the way I tried debian 64bit version (on my Fedora) and it does the very same - connects, I am able to load configuration, but RSHIFT does not turn PS3 on :-(

Edit 2: Oh so I have tried my 2nd controller and it turns on my PS3 now when running emu! This is great, very close. But now when I start emuclient it prints:

Code: Select all

max_axis_value: 255
sdl initialized
A device name is empty. Multiple mice and keyboards are not managed.
close joystick subsystem
emuclient: tcp_connect: Connection refused
Btw roughly looking on the emuclient code nothing is listening on my 21313 port, but I can see this port:

Code: Select all

sudo netstat -lnp | grep 213
tcp        0      0 127.0.0.1:21373             0.0.0.0:*                   LISTEN      13626/./emu
I was entering wrong 3rd parameter, I was entering a controller BT address there for some reason! I guess I need a "controller number". Not sure which one to give - is this the number that is shown on the controller LED?. So instead

Code: Select all

emu AA:AA:AA:AA:AA:AA 0 BB:BB:BB:BB:BB:BB
I am changing this to:

Code: Select all

emu AA:AA:AA:AA:AA:AA 0 1
So emu turns my PS3 on, emuclient connects now, but I am still not to do anything.

EDIT (phorum does not allow me to reply to your post even when its obviously not a double post):

So WITHOUT the parameter it was working, but when I restarted emu server once again, it was not working any more. I hade a HUGE lag with Fedora :-( Will fix the tutorial, but I am not able to use it. Will try once again with Ubuntu sometime. Thanks for help.
Last edited by lzap on Sun Mar 04, 2012 11:30 am, edited 1 time in total.
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: [HOWTO] From command line

Post by Matlo »

The sixaxis number argument is an index!
Try with 0, or don't specify anything.
GIMX creator
Post Reply