T3.6 USB Host - Bluetooth

@mjs513 and @defragster and others who may like to play around,

I pushed up the at least start for PS3 Bluetooth support.

Note: I don't have any PS3 pairing support built in yet... I first did a bind of a Bluetooth dongle and a PS3 using an RPI3 and the sixpair program to program the PS3.

I updated the JoystickBT example app to know if the device connecting is a PS3, it uses a different display and process function, which by default is only showing a subset of the information.
Will add more soon,

Also I put code on when you press the L3 button (That is the press the left joystick in to click), where it toggles it output raw full data instead.

Also some of the rumble and leds is limping along, Still needs to be cleaned up.

Would maybe like to go back now and see if I can find place in pairing code that we can ask for remote name and use it... Also would like to go through as mentioned and remove delays...
And cleanup some more stuff...

But though I would put it up there so someone could start playing with it.

As for being the only Joysticks... The are the only BT versions so far, did at one point have XBox360 and XBoxOne I think with USB... Will look again at BT once the one I ordered arrives. Also can always configure another Teensy to be a joystick as well (USB)

May check the actual one I have as well.
 
@KurtE and @defragster

Think I got everything that a PS4 can offer going now. Attached is an updated JoystickBT sketch that includes a helperPS.h tab as a proof of concept. Again this is just a test - not final:

View attachment JoystickBT.zip

KurtE said:
Note: I don't have any PS3 pairing support built in yet... I first did a bind of a Bluetooth dongle and a PS3 using an RPI3 and the sixpair program to program the PS3.

I updated the JoystickBT example app to know if the device connecting is a PS3, it uses a different display and process function, which by default is only showing a subset of the information.
Will add more soon,
Will take a look either tonight or tomorrow morning before everyone gets up :)

can't seem to find sixaxis for windows anywhere.
 
Doing a quick look for sixpair...

I see links for windows: http://dancingpixelstudios.com/sixaxis-controller/sixaxispairtool/
https://sixaxispairtool.en.lo4d.com/

The sources I used I believe came from: https://github.com/strawlab/joystick_drivers/tree/master/ps3joy

Although not sure... Obviously would be great to setup a Teensy version, which maybe first you plug in BT dongle and it reads in the address of it, then
you plug in the PS3, and it updates the firmware... And maybe it optionally can detect that both are there (HUB) and then does it...
 
For my PS3 Bt Joystick this seemed to work ?

The first p#253 WIN link downloaded - took my BT Ser# for PanBT400 {luckily It was printed on the USB output!}
Tried with KE github and post 252 ZIP joystickBT.ino - I see this - and no more after ... need I push a button?:
Code:
04 0A 25 63 74 B5 39 03 40 05 00 01 
BluetoothController::find_driver  driver 1fff4a38
    control callback (bluetooth) 0
0F 04 00 01 19 04 
07 FF 00 25 63 74 B5 39 03 50 4C 41 59 53 54 41 
54 49 4F 4E 28 52 29 33 43 6F 6E 74 65 72 6F 6C 
6C 65 72 2D 50 41 4E 48 41 49 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 
    control callback (bluetooth) 0
0F 04 00 01 09 04 
12 08 00 25 63 74 B5 39 03 00 
03 0B 00 0B 00 25 63 74 B5 39 03 01 00 
1B 03 0B 00 05 
    tx_data(bluetooth) 0
    tx_data(bluetooth) 0
13 05 01 0B 00 02 00 
    tx_data(bluetooth) 0
    tx_data(bluetooth) 0
13 05 01 0B 00 02 00 
    tx_data(bluetooth) 0
    tx_data(bluetooth) 0
    tx_data(bluetooth) 0
13 05 01 0B 00 02 00 
    tx_data(bluetooth) 0
    tx_data(bluetooth) 0
13 05 01 0B 00 02 00 
    control callback (bluetooth) 0
0E 04 01 1A 0C 00 
13 05 01 0B 00 01 00

I swapped to the CSR 4.0 unit and I get nothing - good I didn't start with that one - the Ser# is not printed by Teensy:
*** Device Bluet a12:1 - connected ***
product: CSR8510 A10

So it seems that app pushes in a valid Ser# for Pre-Binding as I ran the sketch with this line:: BluetoothController bluet(myusb);

BTW: Also re-routed the Amazon AC Powered USB3 HUB to reach the T_3.6 and have that HUB on - and the hub and PANBT400 adapter ( the one with the Vend Specific flag) properly recognized and then so was the PS3 JoystickBt!
 
Last edited:
@mjs513 - Pairing the PS3 with BT Dongle... You of course currently have another option, which I have not tried, and use your HS2 setup. When I was briefly looking at it, you have to run something with the BT dongle in it and write down the bluetooth address, you then run a version of the PS3 program with the PS3 constructor having this address as part of it's parameters, then I assume you run it with the PS3 plugged in as USB, at which point I assume it will program the PS3 with the address...

At some point, I was thinking about emulating this, but differently, and have an example sketch (sixpair), which waits for a BT object to be valid. Then ask this object for it's BT address, then have the program wait for a PS3 joystick to be valid, and when found use the address to program it...

@defragster - yes once a PS3 is paired to a dongle, you need to press the PS button, to get it to start the connection process.

Right now still getting some coffee in me orally and doing some attempt(s) to get the remote name in the pair case... Plus hopefully try delay changes soon...

Then need to look at Mike's Joysticks changes and...
 
@KurtE and @defragster
I got a version of sixaxis pairing tool working and was able to change the address on the PS3. It does pair with the two dongles I tried on HS2 but it does pair with USBHost lib. Tim got a lot farther that I did with the pairing. With my CSR4.0 dongle it gets through write scan complete and then nothing:
Code:
D:\Users\Merli\Documents\Arduino\EchoBoth\EchoBoth.ino Feb 21 2019 06:54:04
 PORT Serial1 and BAUD=1843200 
BluetoothController claim this=1fff3be0 vid:pid=a12:1
    9 4 0 0 3 e0 1 1 0 7 5 81 3 10 0 1 7 5 2 2 40 0 1 7 5 82 2 40 0 1 9 4 1 0 2 e0 1 1 0 7 5 3 1 0 0 1 7 5 83 1 0 0 1 9 4 1 1 2 e0 1 1 0 7 5 
    3 1 9 0 1 7 5 83 1 9 0 1 9 4 1 2 2 e0 1 1 0 7 5 3 1 11 0 1 7 5 83 1 11 0 1 9 4 1 3 2 e0 1 1 0 7 5 3 1 19 0 1 7 5 83 1 19 0 1 9 4 1 4 2 e0 
    1 1 0 7 5 3 1 21 0 1 7 5 83 1 21 0 1 9 4 1 5 2 e0 1 1 0 7 5 3 1 31 0 1 7 5 83 1 31 0 1 
      rxep=1(16) txep=2(64) rx2ep=2(64)
HCI_RESET called (03 0c 00 )
    Control callback (bluetooth): 1 : 3 c 0 
BT rx_data(6): e 4 1 3 c 0 
    Command Completed! 
HCI_WRITE_CLASS_OF_DEV called (24 0c 03 04 08 00 )
    Control callback (bluetooth): 3 : 24 c 3 4 8 0 
BT rx_data(6): e 4 1 24 c 0 
    Command Completed! 
HCI_Read_BD_ADDR called (09 10 00 )
    Control callback (bluetooth): 4 : 9 10 0 
BT rx_data(12): e a 1 9 10 0 11 71 da 7d 1a 0 
    Command Completed! 
   BD Addr:11:71:da:7d:1a:0
HCI_Read_Local_Version_Information called (01 10 00 )
    Control callback (bluetooth): 4 : 1 10 0 
BT rx_data(14): e c 1 1 10 0 6 bb 22 6 a 0 bb 22 
    Command Completed! 
    Local Version: 6
HCI_WRITE_SCAN_ENABLE called(1a 0c 01 02 )
    Control callback (bluetooth): 0 : 1a c 1 2 
BT rx_data(6): e 4 1 1a c 0 
    Command Completed! 
Write_Scan_enable Completed
tedBT rx_data(12): 4 a 1e d4 f7 5c 26 0 40 5 0 1 
    Event: Incoming Connect -  1e:d4:f7:5c:26:0 CL:540 LT:1
      Peripheral device
        Keyboard
BluetoothController::find_driver  driver 1fff44f8
HCI_OP_REMOTE_NAME_REQ called (19 04 0a 1e d4 f7 5c 26 00 01 00 00 00 )
    Control callback (bluetooth): 0 : 19 4 a 1e d4 f7 5c 26 0 1 0 0 0 
BT rx_data(6): f 4 0 1 19 4 
    Command 419 Status 0
BT rx_data(16): 7 ff 0 1e d4 f7 5c 26 0 50 4c 41 59 53 54 41 
BT rx_data(16): 54 49 4f 4e 28 52 29 33 20 43 6f 6e 74 72 6f 6c 
BT rx_data(16): 6c 65 72 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(1): 0 
    Event: handle_hci_remote_name_complete(0)
    Remote Name: PLAYSTATION(R)3 Controller
HCI_OP_ACCEPT_CONN_REQ called (09 04 07 1e d4 f7 5c 26 00 00 )
    Control callback (bluetooth): 0 : 9 4 7 1e d4 f7 5c 26 0 0 
BT rx_data(6): f 4 0 1 9 4 
    Command 409 Status 0
BT rx_data(10): 12 8 0 1e d4 f7 5c 26 0 0 
BT rx_data(13): 3 b 0 48 0 1e d4 f7 5c 26 0 1 0 
    Connection Complete - ST:0 LH:48
BT rx_data(9): 20 7 1e d4 f7 5c 26 0 1 

=====================
BT rx2_data(16): 48 20 c 0 8 0 1 0 2 1 4 0 11 0 40 0 
    L2CAP Connection Request: ID: 1, PSM: 11, SCID: 40
L2CAP_CMD_CONNECTION_RESPONSE called(48 20 10 00 0c 00 01 00 03 01 08 00 70 00 40 00 01 00 00 00 )
tx_data callback (bluetooth): 201 : 48 20 10 0 c 0 1 0 3 1 8 0 70 0 40 0 1 0 0 0 
L2CAP_CMD_CONNECTION_RESPONSE called(48 20 10 00 0c 00 01 00 03 01 08 00 70 00 40 00 00 00 00 00 )
tx_data callback (bluetooth): 202 : 48 20 10 0 c 0 1 0 3 1 8 0 70 0 40 0 0 0 0 0 
L2CAP_ConfigRequest called(48 20 10 00 0c 00 01 00 04 02 08 00 40 00 00 00 01 02 ff ff )
tx_data callback (bluetooth): 0 : 48 20 10 0 c 0 1 0 4 2 8 0 40 0 0 0 1 2 ff ff 
BT rx_data(5): 1b 3 48 0 5 
BT rx_data(7): 13 5 1 48 0 1 0 
BT rx_data(7): 13 5 1 48 0 1 0 

=====================
BT rx2_data(16): 48 20 c 0 8 0 1 0 4 2 4 0 70 0 0 0 
    L2CAP config Request: ID: 2, Dest:70, Flags:0,  Options: 0 0 0 0
      Control Configuration request
L2CAP_ConfigResponse called(48 20 12 00 0e 00 01 00 05 02 0a 00 40 00 00 00 00 00 01 02 a0 02 )
BT rx_data(7): 13 5 1 48 0 1 0 

=====================
BT rx2_data(22): 48 20 12 0 e 0 1 0 5 2 a 0 70 0 0 0 0 0 1 2 a0 2 
    L2CAP config Response: ID: 2, Source:70, Flags:0, Result:0, Config: 201
Set HID Protocol 0 (48 20 05 00 01 00 40 00 70 )
tx_data callback (bluetooth): 0 : 48 20 5 0 1 0 40 0 70 2 a 0 40 0 0 0 0 0 1 2 a0 2 
tx_data callback (bluetooth): 0 : 48 20 5 0 1 0 40 0 70 
BT rx_data(7): 13 5 1 48 0 1 0 

=====================
BT rx2_data(16): 48 20 c 0 8 0 1 0 2 3 4 0 13 0 41 0 
    L2CAP Connection Request: ID: 3, PSM: 13, SCID: 41
L2CAP_CMD_CONNECTION_RESPONSE called(48 20 10 00 0c 00 01 00 03 03 08 00 71 00 41 00 01 00 00 00 )
BT rx_data(7): 13 5 1 48 0 1 0 
tx_data callback (bluetooth): 203 : 48 20 10 0 c 0 1 0 3 3 8 0 71 0 41 0 1 0 0 0 
L2CAP_CMD_CONNECTION_RESPONSE called(48 20 10 00 0c 00 01 00 03 03 08 00 71 00 41 00 00 00 00 00 )
tx_data callback (bluetooth): 204 : 48 20 10 0 c 0 1 0 3 3 8 0 71 0 41 0 0 0 0 0 
L2CAP_ConfigRequest called(48 20 10 00 0c 00 01 00 04 04 08 00 41 00 00 00 01 02 ff ff )
BT rx_data(7): 13 5 1 48 0 1 0 
tx_data callback (bluetooth): 0 : 48 20 10 0 c 0 1 0 4 4 8 0 41 0 0 0 1 2 ff ff 
BT rx_data(7): 13 5 1 48 0 1 0 

=====================
BT rx2_data(16): 48 20 c 0 8 0 1 0 4 4 4 0 71 0 0 0 
    L2CAP config Request: ID: 4, Dest:71, Flags:0,  Options: 0 0 1 2
      Interrupt Configuration request
L2CAP_ConfigResponse called(48 20 12 00 0e 00 01 00 05 04 0a 00 41 00 00 00 00 00 01 02 a0 02 )
BT rx_data(7): 13 5 1 48 0 1 0 

=====================
BT rx2_data(22): 48 20 12 0 e 0 1 0 5 4 a 0 71 0 0 0 0 0 1 2 a0 2 
    L2CAP config Response: ID: 4, Source:71, Flags:0, Result:0, Config: 201
HCI_WRITE_SCAN_ENABLE called(1a 0c 01 02 )
tx_data callback (bluetooth): 0 : 1a c 1 2 e 0 1 0 5 4 a 0 41 0 0 0 0 0 1 2 a0 2 
    Control callback (bluetooth): 0 : 1a c 1 2 
BT rx_data(7): 13 5 1 48 0 1 0 
BT rx_data(6): e 4 1 1a c 0 
    Command Completed! 
Write_Scan_enable Completed
ted

EDIT: With the Broadcom dongle it gets about one line further:
Code:
Write_Scan_enable Completed
BT rx_data(7): 13 5 1 b 0 1 0 
 0
 
KurtE said:
Right now still getting some coffee in me orally and doing some attempt(s) to get the remote name in the pair case... Plus hopefully try delay changes soon...

Then need to look at Mike's Joysticks changes and...
I am doing about the same. Wife and my little yorkie got up early to make me breakfast since its my birthday, killed my morning, but was nice. Now everyone is back to sleep and I get to play.

My changes is just a proof of concept and should just be a plug and play to your sketch.
 
Hi @mjs513... Is this using the stuff I checked in?

I will start with another dongle soon and see if something is strange...

The thing I am noticing on quick check is: Set HID Protocol 0 (48 20 05 00 01 00 40 00 70 )
I believe there is code in place to suppress this output for PS3...

Maybe need to check if the String compare for Remote Name: PLAYSTATION(R)3 Controller
is correct or we need to change it slightly?
 
Morning @KurtE.
It should be - I just updated 3 files - USBHost_t36, Bluetooth and Joystick files. Think those were the only ones that changed.

Just for ref I ran a partial dump for the PS3 on HS2:
Code:
PS3 Bluetooth Library Started
Bluetooth Dongle Initialized
HCI Reset complete
Write class of device
Local Bluetooth Address: 5C:F3:70:7A:1C:C9
Wait For Incoming Connection Request
Keyboard is connecting
Incoming Connection Request
Remote Name: PLAYSTATION(R)3 Controller
Connected to Device: 00:26:5C:F7:D4:1E
HID Control Incoming Connection Request
L2CAP_COMMAND: 0x0B - Channel ID: 00 01
 Data:  0B 20 10 00 0C 00 01 00 03 01 08 00 40 00 40 00 01 00 00 00
L2CAP_COMMAND: 0x0B - Channel ID: 00 01
 Data:  0B 20 10 00 0C 00 01 00 03 01 08 00 40 00 40 00 00 00 00 00
L2CAP_COMMAND: 0x0B - Channel ID: 00 01
 Data:  0B 20 10 00 0C 00 01 00 04 02 08 00 40 00 00 00 01 02 FF FF
L2CAP_COMMAND: 0x0B - Channel ID: 00 01
 Data:  0B 20 12 00 0E 00 01 00 05 02 0A 00 40 00 00 00 00 00 01 02 A0 02
HID Control Successfully Configured
HID Interrupt Incoming Connection Request
L2CAP_COMMAND: 0x0B - Channel ID: 00 01
 Data:  0B 20 10 00 0C 00 01 00 03 03 08 00 41 00 41 00 01 00 00 00
L2CAP_COMMAND: 0x0B - Channel ID: 00 01
 Data:  0B 20 10 00 0C 00 01 00 03 03 08 00 41 00 41 00 00 00 00 00
L2CAP_COMMAND: 0x0B - Channel ID: 00 01
 Data:  0B 20 10 00 0C 00 01 00 04 04 08 00 41 00 00 00 01 02 FF FF
L2CAP_COMMAND: 0x0B - Channel ID: 00 01
 Data:  0B 20 12 00 0E 00 01 00 05 04 0A 00 41 00 00 00 00 00 01 02 A0 02
HID Interrupt Successfully Configured
Wait For Incoming Connection Request
L2CAP_COMMAND: 0x0B - Channel ID: 00 40
 Data:  0B 20 0A 00 06 00 40 00 53 F4 42 03 00 00
Dualshock 3 Controller Enabled

L2CAP_COMMAND: 0x0B - Channel ID: 00 40
 Data:  0B 20 36 00 32 00 40 00 52 01 00 00 00 00 00 00 00 00 00 02 FF 27 10 00 32 FF 27 10 00 32 FF 27 10 00 32 FF 27 10 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
Hi Mike,

You might try changing:
Code:
void JoystickController::remoteNameComplete(const uint8_t *remoteName) 
{
	// Sort of a hack, but try to map the name given from remote to a type...
	if (!remoteName) return;

	if (strncmp((const char *)remoteName, "Wireless Controller", 19) == 0) {
		DBGPrintf("  JoystickController::remoteNameComplete %s - set to PS4\n", remoteName);
		special_process_required = SP_NEED_CONNECT; 		// We need to force this. 
		joystickType = PS4;
	} else if (strncmp((const char *)remoteName, "PLAYSTATION(R)3 Controller", 26) == 0) {
		DBGPrintf("  JoystickController::remoteNameComplete %s - set to PS3\n", remoteName);
		special_process_required = SP_PS3_IDS; 		// PS3 maybe needs different IDS. 
		joystickType = PS3;
	} else {
		DBGPrintf("  JoystickController::remoteNameComplete %s - Unknown\n", remoteName);
	}
}
And see if we are not matching the name? It looks correct, but ???
Edit, maybe change above to something like:DBGPrintf(" JoystickController::remoteNameComplete (%s) - Unknown\n", remoteName);
And/or also print out the length of the string passed in...
 
Kurt - Tim

I just noticed something interesting as well in what I posted, the PS3 is being identified as a Keyboard?
Code:
    Event: Incoming Connect -  1e:d4:f7:5c:26:0 CL:540 LT:1
      Peripheral device
        Keyboard

EDIT: Posts crossed - will take a look - have a quick errand to do :) Including getting more coffee
 
Ok - added it but don't think it ever gets that far to call remotename:
This call is never happening:
Code:
	if (device_driver_) {
		device_driver_->remoteNameComplete(&rxbuf_[9]);
		if (device_driver_->special_process_required & BTHIDInput::SP_PS3_IDS) {
			DBGPrintf("PS3 IDENTIFIED & remoteNameComplete called === > \n");
			// Real hack see if PS3... 
	    	control_dcid_ = 0x40;
	    	interrupt_dcid_ = 0x41;
	    }
	}
.
 
Yep - that looks interesting, mine starts off like:
Code:
BT rx_data(12): 4 a 8d cc 2d 33 24 0 8 5 0 1
    Event: Incoming Connect -  8d:cc:2d:33:24:0 CL:508 LT:1
      Peripheral device
        Gamepad
BluetoothController::find_driver  driver 20004e18
JoystickController::claim_bluetooth TRUE
    *** Claimed ***
HCI_OP_REMOTE_NAME_REQ called (19 04 0a 8d cc 2d 33 24 00 01 00 00 00 )
    Control callback (bluetooth): 0 : 19 4 a 8d cc 2d 33 24 0 1 0 0 0
BT rx_data(6): f 4 0 1 19 4
    Command 419 Status 0
BT rx_data(16): 7 ff 0 8d cc 2d 33 24 0 50 4c 41 59 53 54 41
BT rx_data(16): 54 49 4f 4e 28 52 29 33 20 43 6f 6e 74 72 6f 6c
BT rx_data(16): 6c 65 72 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BT rx_data(1): 0
    Event: handle_hci_remote_name_complete(0)
    Remote Name: PLAYSTATION(R)3 Controller
  JoystickController::remoteNameComplete PLAYSTATION(R)3 Controller - set to PS3
Question is how to catch this? Currently the claim code is singular... by class:
Code:
bool JoystickController::claim_bluetooth(BluetoothController *driver, uint32_t bluetooth_class) 
{
	if ((((bluetooth_class & 0xff00) == 0x2500) || (((bluetooth_class & 0xff00) == 0x500))) && ((bluetooth_class & 0x3C) == 0x08)) {
		DBGPrintf("JoystickController::claim_bluetooth TRUE\n");
		btdriver_ = driver;
		btdevice = (Device_t*)driver;	// remember this way 
		return true;
	}
	return false;
}

And Happy Birthday!
 
Right now I am picking up the controller as a class of 540 vs your 508. My ps3 is identified as a Dualshock PS3 - not sure if that makes a difference. Can't really tell what Tim is getting from his dump yet. Anyway, maybe we need to add a correction for class 540?
 
Right now I am picking up the controller as a class of 540 vs your 508. My ps3 is identified as a Dualshock PS3 - not sure if that makes a difference. Can't really tell what Tim is getting from his dump yet. Anyway, maybe we need to add a correction for class 540?

The problem is that 540 will typically be claimed by Keyboard, which does:
Code:
bool KeyboardController::claim_bluetooth(BluetoothController *driver, uint32_t bluetooth_class) 
{
	USBHDBGSerial.printf("Keyboard Controller::claim_bluetooth - Class %x\n", bluetooth_class);
	if ((((bluetooth_class & 0xff00) == 0x2500) || (((bluetooth_class & 0xff00) == 0x500))) && (bluetooth_class & 0x40)) {
		USBHDBGSerial.printf("KeyboardController::claim_bluetooth TRUE\n");
		//btdevice = driver;
		return true;
	}
	return false;
}
Which you are not seeing as you don't have keyboard object in this sketch... Temporarily to see if everything else works with yours... You could hack it up to also support 0x540...

Right now I am thinking of doing a set of real hacks...
That is, something like:
Have the cliam_bluetooth code work sort of like now, but add on another parameter (Name), which in this first case will be NULL...
Then when we get the name complete, allow the remoteNameComplete to return a value (like false - default is true), and have keyboard check for the PS3 and return false.

Then in the place that sent out: remoteNameComplete, if either no one has claimed it yet (or) the one who claimed it, has now rejected it, then call off to
again to claim_bluetooth - with the name, at which point keyboard will reject again and/or if joystick sees it first again check for PLAYSTATION and go ahead and accept.
Not sure if it again needs to call off to remoteNameComplete or not...

Again sort of a kludge, but maybe there will be other cases where this comes up...
 
@KurtE

Sounds a lot better than my approach. At least yours make more sense in the longer term.
 
I pushed up a hack like I mentioned. I did a quick and dirty test PS3 still runs... Have not tried other things yet...

Ordered a single PS3 (same link, but to the single option)...
 
Hi Tim = Kurt

Thanks for the birthday wishes :) Officially a senior citizen today (65, argh). Anyway back to work :)

Nope not SR+ member yet - I did send Robin an email though - shes probably got her hands full out there.

Kurt - just gave you changes a try for the PS3 and nothing - I mean it never connects to the dongle - just keeps blinking. BUt the good news is that the PS4 still works.

EDIT: It does still connect using HS2 though so its not the pairing
 
Hi Mike,

65! 8) - Welcome to medicare, luckily I still have a few years, until then... (very few :( ) Just say I am only a few days away from being able to get early Social Security...

Note: The blinking... I don't turn off, unless the Leds is updated by pressing the square or triangle or circle...

Would be interesting to see a trace to see if what I expected happened, that is the first pass find driver will fail as you don't have any drivers that support that code (unless you have keyboard). Then when name code is complete, it should again call find driver with the name and then Joystick controller should claim it... (Unless I screwed up)... But again would be interesting to see what happens around when name complete happens.
 
Time does fly doesn't it - think I am younger sometimes then I am sorry that I forgot :)

Just tried pressing the buttons - but still blinking. Here's the trace I get - didn't attach last message - forgot to hook up the 3.2:
Code:
D:\Users\Merli\Documents\Arduino\EchoBoth\EchoBoth.ino Feb 21 2019 06:54:04
 PORT Serial1 and BAUD=1843200 
BluetoothController claim this=1fff3be0 vid:pid=a5c:21e8
    9 4 0 0 3 ff 1 1 0 7 5 81 3 10 0 1 7 5 82 2 40 0 1 7 5 2 2 40 0 1 9 4 1 0 2 ff 1 1 0 7 5 83 1 0 0 1 7 5 3 1 0 0 1 9 4 1 1 2 ff 1 1 0 7 5 
    83 1 9 0 1 7 5 3 1 9 0 1 9 4 1 2 2 ff 1 1 0 7 5 83 1 11 0 1 7 5 3 1 11 0 1 9 4 1 3 2 ff 1 1 0 7 5 83 1 19 0 1 7 5 3 1 19 0 1 9 4 1 4 2 ff 
    1 1 0 7 5 83 1 21 0 1 7 5 3 1 21 0 1 9 4 1 5 2 ff 1 1 0 7 5 83 1 31 0 1 7 5 3 1 31 0 1 9 4 2 0 2 ff ff ff 0 7 5 84 2 20 0 1 7 5 4 2 20 0 1 9 
    4 3 0 0 fe 1 1 0 9 21 5 88 13 40 0 10 1 
      rxep=1(16) txep=2(64) rx2ep=2(64)
HCI_RESET called (03 0c 00 )
    Control callback (bluetooth): 1 : 3 c 0 
BT rx_data(6): e 4 1 3 c 0 
    Command Completed! 
HCI_WRITE_CLASS_OF_DEV called (24 0c 03 04 08 00 )
    Control callback (bluetooth): 3 : 24 c 3 4 8 0 
BT rx_data(6): e 4 1 24 c 0 
    Command Completed! 
HCI_Read_BD_ADDR called (09 10 00 )
    Control callback (bluetooth): 4 : 9 10 0 
BT rx_data(12): e a 1 9 10 0 c9 1c 7a 70 f3 5c 
    Command Completed! 
   BD Addr:c9:1c:7a:70:f3:5c
HCI_Read_Local_Version_Information called (01 10 00 )
    Control callback (bluetooth): 4 : 1 10 0 
BT rx_data(14): e c 1 1 10 0 6 0 10 6 f 0 e 22 
    Command Completed! 
    Local Version: 6
HCI_WRITE_SCAN_ENABLE called(1a 0c 01 02 )
    Control callback (bluetooth): 0 : 1a c 1 2 
BT rx_data(6): e 4 1 1a c 0 
    Command Completed! 
Write_Scan_enable Completed
tedBT rx_data(12): 4 a 1e d4 f7 5c 26 0 40 5 0 1 
    Event: Incoming Connect -  1e:d4:f7:5c:26:0 CL:540 LT:1
      Peripheral device
        Keyboard
BluetoothController::find_driver  driver 1fff44f8
HCI_OP_REMOTE_NAME_REQ called (19 04 0a 1e d4 f7 5c 26 00 01 00 00 00 )
    Control callback (bluetooth): 0 : 19 4 a 1e d4 f7 5c 26 0 1 0 0 0 
BT rx_data(6): f 4 0 1 19 4 
    Command 419 Status 0
BT rx_data(16): 7 ff 0 1e d4 f7 5c 26 0 50 4c 41 59 53 54 41 
BT rx_data(16): 54 49 4f 4e 28 52 29 33 20 43 6f 6e 74 72 6f 6c 
BT rx_data(16): 6c 65 72 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
BT rx_data(1): 0 
    Event: handle_hci_remote_name_complete(0)
    Remote Name: PLAYSTATION(R)3 Controller
[COLOR="#FF0000"]BluetoothController::find_driver  driver 1fff44f8
JoystickController::claim_bluetooth TRUE PS3 hack...[/COLOR]
    *** Claimed ***
HCI_OP_ACCEPT_CONN_REQ called (09 04 07 1e d4 f7 5c 26 00 00 )
    Control callback (bluetooth): 0 : 9 4 7 1e d4 f7 5c 26 0 0 
BT rx_data(6): f 4 0 1 9 4 
    Command 409 Status 0
BT rx_data(10): 12 8 0 1e d4 f7 5c 26 0 0 
BT rx_data(13): 3 b 0 b 0 1e d4 f7 5c 26 0 1 0 
    Connection Complete - ST:0 LH:b
BT rx_data(5): 1b 3 b 0 5 

=====================
BT rx2_data(16): b 20 c 0 8 0 1 0 2 1 4 0 11 0 40 0 
    L2CAP Connection Request: ID: 1, PSM: 11, SCID: 40
L2CAP_CMD_CONNECTION_RESPONSE called(0b 20 10 00 0c 00 01 00 03 01 08 00 40 00 40 00 01 00 00 00 )
tx_data callback (bluetooth): 201 : b 20 10 0 c 0 1 0 3 1 8 0 40 0 40 0 1 0 0 0 
L2CAP_CMD_CONNECTION_RESPONSE called(0b 20 10 00 0c 00 01 00 03 01 08 00 40 00 40 00 00 00 00 00 )
tx_data callback (bluetooth): 202 : b 20 10 0 c 0 1 0 3 1 8 0 40 0 40 0 0 0 0 0 
L2CAP_ConfigRequest called(0b 20 10 00 0c 00 01 00 04 02 08 00 40 00 00 00 01 02 ff ff )
BT rx_data(7): 13 5 1 b 0 2 0 
tx_data callback (bluetooth): 0 : b 20 10 0 c 0 1 0 4 2 8 0 40 0 0 0 1 2 ff ff 

=====================
BT rx2_data(16): b 20 c 0 8 0 1 0 4 2 4 0 40 0 0 0 
    L2CAP config Request: ID: 2, Dest:40, Flags:0,  Options: 0 0 0 0
      Control Configuration request
L2CAP_ConfigResponse called(0b 20 12 00 0e 00 01 00 05 02 0a 00 40 00 00 00 00 00 01 02 a0 02 )

=====================
BT rx2_data(22): b 20 12 0 e 0 1 0 5 2 a 0 40 0 0 0 0 0 1 2 a0 2 
    L2CAP config Response: ID: 2, Source:40, Flags:0, Result:0, Config: 201
tx_data callback (bluetooth): 0 : b 20 12 0 e 0 1 0 5 2 a 0 40 0 0 0 0 0 1 2 a0 2 
BT rx_data(7): 13 5 1 b 0 2 0 

=====================
BT rx2_data(16): b 20 c 0 8 0 1 0 2 3 4 0 13 0 41 0 
    L2CAP Connection Request: ID: 3, PSM: 13, SCID: 41
L2CAP_CMD_CONNECTION_RESPONSE called(0b 20 10 00 0c 00 01 00 03 03 08 00 41 00 41 00 01 00 00 00 )
tx_data callback (bluetooth): 203 : b 20 10 0 c 0 1 0 3 3 8 0 41 0 41 0 1 0 0 0 
L2CAP_CMD_CONNECTION_RESPONSE called(0b 20 10 00 0c 00 01 00 03 03 08 00 41 00 41 00 00 00 00 00 )
tx_data callback (bluetooth): 204 : b 20 10 0 c 0 1 0 3 3 8 0 41 0 41 0 0 0 0 0 
L2CAP_ConfigRequest called(0b 20 10 00 0c 00 01 00 04 04 08 00 41 00 00 00 01 02 ff ff )
BT rx_data(7): 13 5 1 b 0 2 0 
tx_data callback (bluetooth): 0 : b 20 10 0 c 0 1 0 4 4 8 0 41 0 0 0 1 2 ff ff 

=====================
BT rx2_data(16): b 20 c 0 8 0 1 0 4 4 4 0 41 0 0 0 
    L2CAP config Request: ID: 4, Dest:41, Flags:0,  Options: 0 0 1 2
      Interrupt Configuration request
L2CAP_ConfigResponse called(0b 20 12 00 0e 00 01 00 05 04 0a 00 41 00 00 00 00 00 01 02 a0 02 )
tx_data callback (bluetooth): 0 : b 20 12 0 e 0 1 0 5 4 a 0 41 0 0 0 0 0 1 2 a0 2 

=====================
BT rx2_data(22): b 20 12 0 e 0 1 0 5 4 a 0 41 0 0 0 0 0 1 2 a0 2 
    L2CAP config Response: ID: 4, Source:41, Flags:0, Result:0, Config: 201
HCI_WRITE_SCAN_ENABLE called(1a 0c 01 02 )
    Control callback (bluetooth): 0 : 1a c 1 2 
BT rx_data(7): 13 5 1 b 0 2 0 
BT rx_data(6): e 4 1 1a c 0 
    Command Completed! 
Write_Scan_enable Completed
[COLOR="#FF0000"]  JoystickController::connectionComplete joystick type 1
enable six axis[/COLOR]
sendL2CapCommand: 2002ff00 6 ffffffff
0b 20 0a 00 06 00 40 00 53 f4 42 03 00 00 )
tx_data callback (bluetooth): 0 : b 20 a 0 6 0 40 0 53 f4 42 3 0 0 

=====================
BT rx2_data(9): b 20 5 0 1 0 40 0 0 
BT rx_data(7): 13 5 1 b 0 1 0
 
Looks like the hacks are being processed... May have some stuff to figure out on it... One like yours should arrive Monday...

Right now, maybe taking diversion and maybe posting some questions up on Trossen and Robotis Forums about suggested electronics/wiring for the PhantomX (Hexapod) with XL430 - where trying to get Trossen away from proprietary boards (Arbotix microcontroller AVR Atmega644P), which they have no one technical left at the company that can/will support it... Their last official support was for Arduino 1.0.4. I have setups for them for everything since then, but...

So trying to get them to a controller they can simply buy and someone is actually supporting, like Robotis (OpenCM, OpenCR, XEL).

Also What input input controller to use... Their Arbotix board had an XBee connection and they have a controller Arbotix Commander (Shield) with XBee, that I also know that Trossen would like to not have to support anymore as well...

Plus how to wire it up...

Personally I would love to have it based on Teensy 4 or 3.6, but no commercially available controller board, and I don't want to be the one who ends up supporting it (except for my own usage)

But enough off topic (But again T4 with USB host and PS3 would be perfect!)
 
Back
Top