T3.6 USB Host - Bluetooth

@mjs513 - Yep I was going to look at that sort of next.

I Was also thinking of updating the buttons processing and reverse the bytes, to make them a little more compatible with for example XBox One when plugged in...

But sort of interesting on labels on Joysticks
IMG_0264.jpg
You will notice that the Switch changed what button is X, Y, A, B versus the XBox One and XBox 360.

But I was noticing that pressing the buttons, the bytes are mostly reversed here.
That is O(XBOX ONE) S(SWITCH)
Hex...
O-X 80 S-Y 8000
A 20 B 2000
..

L3 4000 400 I think these are off
R3

Hat: ...

So will swap bytes in button field and see how that feels.
 
Quick update - from linux box

Here is some of the data about the SWITCH controller:
Code:
$ lsusb -v -d 45e:028e

Bus 003 Device 006: ID 045e:028e Microsoft Corp. Xbox360 Controller
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass       255 Vendor Specific Subclass
  bDeviceProtocol       255 Vendor Specific Protocol
  bMaxPacketSize0        64
  idVendor           0x045e Microsoft Corp.
  idProduct          0x028e Xbox360 Controller
  bcdDevice            1.10
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           48
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     93 
      bInterfaceProtocol      1 
      iInterface              0 
      ** UNRECOGNIZED:  10 21 10 01 01 24 81 14 03 00 03 13 02 00 03 00
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               8
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               8

</pre>

Note: again like XBox... Not a HID device
 
Have worked here testing what was working - but never looked at the code. Lots of changes evolving support for Xbox[1,2,3] and PS[x,y,z] - too much to put in short release TD1.53 - but as soon as it goes in to TD it will get outdated or need custom hacks to work with device X+1?

Is there a way [i.e. total rewrite?] to have CORE USB_Host included and at build time link in added functionality/support for Device X+1 and of course Y and Z from user code or 'daughter' libraries?

Is device detection list driven or all bunched up some 'static' core code.

Gotta run - just thought I'd liven up the discussion :)
 
Good morning @defragster -

Actually most all of the changes for XBox and PS3 were reasonably long ago... Currently the only changes pending are
associated with Bluetooth, where before I had a single set of variables associated with the connection information between an active paired device and the Bluetooth object,
I instead made those into an array of values as to allow multiple devices to use the Bluetooth object at the same time.

Example: I have had a Bluetooth keyboard and a Bluetooth Mouse working at the same time, just like I have currently working on my PC....

But I totally understand not pulling that in until after this next release... So there are a few changes on that branch on trying to get the Nintendo Switch controller to work.


Yes - There are complications with trying to support all of these devices at the same time.

You already have the choice in your sketch to have your own device objects, that like some of our higher level objects like Joystick, Mouse, Keyboard, are derived from the building blocks, like the low level device, or HID device, or BlueTooth HID device...

And yes you can maybe make that code easier, if you restrict it to a specific piece of hardware.

This is sort of what the USB Host Shield code does, where for example your sketch has to decide which actual device you are using and how it is connected. Example instead of saying I want a joystick. You instead say I want a USB PS3 or a Bluetooth PS3 or USB PS4... Which can work well, but I personally prefer saying I want a joystick... And then adapt to which one that is plugged in.

Also you run into the issues, like with Bluetooth, where PS3 did not follow the BT standards and did not properly work on most systems. Which is why there are several drivers for systems out there to support it. Then later hacks were added into many/most Bluetooth drivers to handle them.

And yes we can probably greatly enhance this system, by having a better understanding of the many different Bluetooth subsystems and standards and using them to properly talk to and pair with devices. A lot of the current code was done by reverse engineering several of the devices until they worked... But there are still several that don't, Example with XBox One is using a different section for pairing than we have implemented yet. Likewise for my Microsoft Sculpt Mouse, which also communicates at the 480mhz I think so I can not capture their communications.

But I would suggest that we do some major rework of the Bluetooth as I don't like how I setup the constructor for pairing or not pairing, like the host shield code did, but would rather have the ability for UI to decide to go into pairing mode or not. Plus a better understanding of the different pairing steps that we should take.

But in the mean time one can reduce it down to building blocks you wish to use. By simply implementing your own top blocks ;)

Sorry I know the above is clear as mud!

Kurt
 
Hello @KurtE!

'Clear as mud' makes sense since I just threw 'a handful of mud' without knowing of which I spoke :)

Again just walking behind the changes for devices I got without taking time to understand the nature of the code or the tweeks involved to recognize/respond to and get a device online I was just wondering if the 'getting a unique device online' and programming the response were removed from the core - perhaps it is all in the examples - it seemed the that updating the core wouldn't be such a problem if only the example code per device needed changed or replicated.

So it seems the changes are in the direction of just having the core Host code just be robust enough to support the variety of devices and their presentation across the breadth of the USB spec as (ab)used by device makers ... HID, Bt HID, RAWHid, wired, wireless Bt ...

Have also never used a " USB Host Shield " to know how it works better or differently - though see it pop up in posts for detection in how to emulate the behavior/abilities it has on Teensy. Not even sure if that is from long developed software or native hardware abilities.

Until I get around to needing it personally ... keep up the good work.
 
I bought this $20 Techkey USB Mini Bluetooth 5.0 EDR Dongle.

Powering up the working and known CSR dongle gave this debug text and (not shown) it paired/connected MSFT Bt mouse - then disconnected/unplugged: View attachment BT CSR WORKS.txt

Powering up the new TechKey dongle gave this debug text and no notes to connect MSFT Bt mouse - then unplugged: View attachment TechKey_Bt_Fails.txt

Doing a DIFF on the two - it isn't clear where the issue is as - except for small digits diffs - they mostly seems to get the same recognition.

Where would I being to get Pairing to function? Are the small digit diffs showing the command they respond to?
 
@defragster Good Morning:

May be the dongle itself. Reading the debug looks like it recognizes the dongle:
Code:
*** Device Bluet bda:8771 - connected ***
  manufacturer: Realtek
  product: Bluetooth Radio
  Serial: 00E04C239987
but i know this is a dump question but are you using the BT mouse example. Haven't really played with mice always focused on joysticks but noticed this:
Code:
USBHub claim_device this=20005040
USBHub memory usage = 960
USBHub claim_device this=20004040
KeyboardController claim this=20003AE0
KeyboardController claim this=20003D80
HIDParser claim this=20006120
HIDParser claim this=20004400
HIDParser claim this=20004A20
HIDParser claim this=20006740
HIDParser claim this=20005400
JoystickController claim this=20006EE0
BluetoothController claim this=20005A80
BluetoothController, rxep=1(16), txep=2(64)
Don't see mouse listed anywhere? Have to see if i can dig one up.
 
Microsoft Mouse... Depends on which one... Also as mentioned I did not see any mention of Mouse. So make sure example has a mouse object in it. Also probably need to make sure the Bluetooth object is the one with the pairing stuff enabled.

I have another Microsoft Mouse (Surface Arc), that I have not been successful in using. As it requires more of subsystems than we have partial implementations for.
 
Yes noted about the mouse came online with CSR - but didn't include that to minimize the diff.

OPPPS - the mouse was LOGITECH M557!

Just powered MSFT mouse (unlabeled? Sculpt?) worked before and now on CSR noted below - and ignored on TechKey.

Sketch: ...\hardware\teensy\avr\libraries\USBHost_t36\examples\Bluetooth\MouseBT\MouseBT.ino

Here is debug startup on CSR where mouse then recognized and reports when I set it down.
At the same point the TechKey looked to be online - there was Debug silence when the mouse asked to pair:
Code:
USB Host Testing
960
USB2 PLL running
 reset waited 6
USBHS_ASYNCLISTADDR = 0
USBHS_PERIODICLISTBASE = 20008000
periodictable = 20008000
port change: 10001803
    connect
  begin reset
port change: 10001805
  port enabled
  end recovery
new_Device: 12 Mbit/sec
new_Pipe
enumeration:
enumeration:
enumeration:
Device Descriptor:
  12 01 00 02 E0 01 01 40 12 0A 01 00 91 88 00 02 00 01 
    VendorID = 0A12, ProductID = 0001, Version = 8891
    Class/Subclass/Protocol = 224 / 1 / 1
    Number of Configurations = 1
enumeration:
enumeration:
Product: CSR8510 A10
enumeration:
Config data length = 177
enumeration:
Configuration Descriptor:
  09 02 B1 00 02 01 00 E0 32 
    NumInterfaces = 2
    ConfigurationValue = 1
  09 04 00 00 03 E0 01 01 00 
    Interface = 0
    Number of endpoints = 3
    Class/Subclass/Protocol = 224 / 1 / 1
  07 05 81 03 10 00 01 
    Endpoint = 1 IN
    Type = Interrupt
    Max Size = 16
    Polling Interval = 1
  07 05 02 02 40 00 01 
    Endpoint = 2 OUT
    Type = Bulk
    Max Size = 64
    Polling Interval = 1
  07 05 82 02 40 00 01 
    Endpoint = 2 IN
    Type = Bulk
    Max Size = 64
    Polling Interval = 1
  09 04 01 00 02 E0 01 01 00 
    Interface = 1
    Number of endpoints = 2
    Class/Subclass/Protocol = 224 / 1 / 1
  07 05 03 01 00 00 01 
    Endpoint = 3 OUT
    Type = Isochronous
    Max Size = 0
    Polling Interval = 1
  07 05 83 01 00 00 01 
    Endpoint = 3 IN
    Type = Isochronous
    Max Size = 0
    Polling Interval = 1
  09 04 01 01 02 E0 01 01 00 
    Interface = 1
    Number of endpoints = 2
    Class/Subclass/Protocol = 224 / 1 / 1
  07 05 03 01 09 00 01 
    Endpoint = 3 OUT
    Type = Isochronous
    Max Size = 9
    Polling Interval = 1
  07 05 83 01 09 00 01 
    Endpoint = 3 IN
    Type = Isochronous
    Max Size = 9
    Polling Interval = 1
  09 04 01 02 02 E0 01 01 00 
    Interface = 1
    Number of endpoints = 2
    Class/Subclass/Protocol = 224 / 1 / 1
  07 05 03 01 11 00 01 
    Endpoint = 3 OUT
    Type = Isochronous
    Max Size = 17
    Polling Interval = 1
  07 05 83 01 11 00 01 
    Endpoint = 3 IN
    Type = Isochronous
    Max Size = 17
    Polling Interval = 1
  09 04 01 03 02 E0 01 01 00 
    Interface = 1
    Number of endpoints = 2
    Class/Subclass/Protocol = 224 / 1 / 1
  07 05 03 01 19 00 01 
    Endpoint = 3 OUT
    Type = Isochronous
    Max Size = 25
    Polling Interval = 1
  07 05 83 01 19 00 01 
    Endpoint = 3 IN
    Type = Isochronous
    Max Size = 25
    Polling Interval = 1
  09 04 01 04 02 E0 01 01 00 
    Interface = 1
    Number of endpoints = 2
    Class/Subclass/Protocol = 224 / 1 / 1
  07 05 03 01 21 00 01 
    Endpoint = 3 OUT
    Type = Isochronous
    Max Size = 33
    Polling Interval = 1
  07 05 83 01 21 00 01 
    Endpoint = 3 IN
    Type = Isochronous
    Max Size = 33
    Polling Interval = 1
  09 04 01 05 02 E0 01 01 00 
    Interface = 1
    Number of endpoints = 2
    Class/Subclass/Protocol = 224 / 1 / 1
  07 05 03 01 31 00 01 
    Endpoint = 3 OUT
    Type = Isochronous
    Max Size = 49
    Polling Interval = 1
  07 05 83 01 31 00 01 
    Endpoint = 3 IN
    Type = Isochronous
    Max Size = 49
    Polling Interval = 1
enumeration:
USBHub memory usage = 960
USBHub claim_device this=20005040
USBHub memory usage = 960
USBHub claim_device this=20004040
KeyboardController claim this=20003AE0
KeyboardController claim this=20003D80
HIDParser claim this=20006120
HIDParser claim this=20004400
HIDParser claim this=20004A20
HIDParser claim this=20006740
HIDParser claim this=20005400
JoystickController claim this=20006EE0
BluetoothController claim this=20005A80
BluetoothController, rxep=1(16), txep=2(64)
new_Pipe
allocate_interrupt_pipe_bandwidth
 best_bandwidth = 3, at offset = 0, shift= 0
new_Pipe
allocate_interrupt_pipe_bandwidth
 best_bandwidth = 6, at offset = 0, shift= 1
new_Pipe
*** Device Bluet a12:1 - connected ***
  product: CSR8510 A10
    control callback (bluetooth) 1
0E 04 01 03 0C 00 
    control callback (bluetooth) 3
0E 04 01 24 0C 00 
    control callback (bluetooth) 4
0E 0A 01 09 10 00 11 71 DA 7D 1A 00 
    control callback (bluetooth) 4
0E 0C 01 01 10 00 06 BB 22 06 0A 00 BB 22 
    control callback (bluetooth) 6
0E 04 01 45 0C 00 
    control callback (bluetooth) 7
0E 04 01 01 0C 00 
    control callback (bluetooth) 8
0F 04 00 01 01 04 
22 0F 01 1E E3 A9 5D 88 34 01 02 80 25 00 A3 66 
D9 
BluetoothController::find_driver  driver 20003af8
Keyboard Controller::claim_bluetooth - Class 2580
  driver 20003d98
Keyboard Controller::claim_bluetooth - Class 2580
  driver 20005a2c
MouseController Controller::claim_bluetooth - Class 2580
MouseController::claim_bluetooth TRUE
    *** Claimed ***
    control callback (bluetooth) 64
0E 04 01 02 04 00 
    control callback (bluetooth) 65
0F 04 00 01 05 04 
03 0B 00 48 00 1E E3 A9 5D 88 34 01 00 
    control callback (bluetooth) 6E
0F 04 00 01 11 04 
17 06 1E E3 A9 5D 88 34 
    control callback (bluetooth) 78
0E 0A 01 0C 04 00 1E E3 A9 5D 88 34 
16 06 1E E3 A9 5D 88 34 
    control callback (bluetooth) 82
0E 0A 01 0D 04 00 1E E3 A9 5D 88 34 
18 17 1E E3 A9 5D 88 34 18 85 40 EF 8F 46 F9 E6 
8F 17 89 6C D1 59 3F 5F 00 
06 03 00 48 00 
    tx_data(bluetooth) 82
13 05 01 48 00 01 00 
    tx_data(bluetooth) 82
    tx_data(bluetooth) 82
13 05 01 48 00 01 00 
13 05 01 48 00 01 00 
    tx_data(bluetooth) 82
    tx_data(bluetooth) 82
13 05 01 48 00 01 00 
13 05 01 48 00 01 00 
    tx_data(bluetooth) 82
    tx_data(bluetooth) 82
13 05 01 48 00 01 00 
13 05 01 48 00 01 00 
    control callback (bluetooth) 82
0E 04 01 1A 0C 00 
MouseController::process_bluetooth_HID_data 20
  Mouse Data: 11 FF 09 00 5A 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 00 FE 00 
Mouse: buttons = 0,  mouseX = 0,  mouseY = -2,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 FF FF 00 
Mouse: buttons = 0,  mouseX = -1,  mouseY = -1,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 FF FF 00 
Mouse: buttons = 0,  mouseX = -1,  mouseY = -1,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 FF 00 00 
Mouse: buttons = 0,  mouseX = -1,  mouseY = 0,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 FF FF 00 
Mouse: buttons = 0,  mouseX = -1,  mouseY = -1,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 FE 00 00 
Mouse: buttons = 0,  mouseX = -2,  mouseY = 0,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 FF 00 00 
Mouse: buttons = 0,  mouseX = -1,  mouseY = 0,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 FF FF 00 
Mouse: buttons = 0,  mouseX = -1,  mouseY = -1,  wheel = 0,  wheelH = 0

Another device on CSR - that Rii keyboard mouse - doesn't do mouse after claimed - but it powers up with this:
Code:
BluetoothController::find_driver  driver 20003af8
Keyboard Controller::claim_bluetooth - Class 2540
KeyboardController::claim_bluetooth TRUE
    *** Claimed ***
    control callback (bluetooth) 64
0E 04 01 02 04 00 
    control callback (bluetooth) 65
0F 04 00 01 05 04 
03 0B 00 48 00 7C 85 28 0A C5 CC 01 00 
    control callback (bluetooth) 6E
1B 03 48 00 05 
0F 04 00 00 11 04 
17 06 7C 85 28 0A C5 CC 
0F 04 00 01 00 00 
    control callback (bluetooth) 78
0E 0A 01 0C 04 00 7C 85 28 0A C5 CC 
16 06 7C 85 28 0A C5 CC 
    control callback (bluetooth) 82
0E 0A 01 0D 04 00 7C 85 28 0A C5 CC

And the MSFT Mouse on CSR - silent on TechKey:
Code:
22 0F 01 86 13 67 52 1E 7C 01 02 80 25 00 DB 67 
E2 
BluetoothController::find_driver  driver 20003af8
Keyboard Controller::claim_bluetooth - Class 2580
  driver 20003d98
Keyboard Controller::claim_bluetooth - Class 2580
  driver 20005a2c
MouseController Controller::claim_bluetooth - Class 2580
MouseController::claim_bluetooth TRUE
    *** Claimed ***
    control callback (bluetooth) 64
0E 04 01 02 04 00 
    control callback (bluetooth) 65
0F 04 00 01 05 04 
03 0B 00 48 00 86 13 67 52 1E 7C 01 00 
    control callback (bluetooth) 6E
0F 04 00 01 11 04 
17 06 86 13 67 52 1E 7C 
    control callback (bluetooth) 78
0E 0A 01 0C 04 00 86 13 67 52 1E 7C 
16 06 86 13 67 52 1E 7C 
    control callback (bluetooth) 82
0E 0A 01 0D 04 00 86 13 67 52 1E 7C 
18 17 86 13 67 52 1E 7C F9 E3 93 94 E1 00 80 ED 
F8 E8 A3 05 72 10 BC EC 00 
06 03 00 48 00 
    tx_data(bluetooth) 82
13 05 01 48 00 01 00 
    tx_data(bluetooth) 82
    tx_data(bluetooth) 82
13 05 01 48 00 01 00 
    tx_data(bluetooth) 82
13 05 01 48 00 01 00 
    tx_data(bluetooth) 82
13 05 01 48 00 01 00 
13 05 01 48 00 01 00 
    tx_data(bluetooth) 82
    tx_data(bluetooth) 82
13 05 01 48 00 01 00 
13 05 01 48 00 01 00 
    control callback (bluetooth) 82
0E 04 01 1A 0C 00 
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 00 00 00 
Mouse: buttons = 0,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 00 00 00 
Mouse: buttons = 0,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 00 00 00 
Mouse: buttons = 0,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 00 00 00 
Mouse: buttons = 0,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 00 00 00 
Mouse: buttons = 0,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 00 00 00 
Mouse: buttons = 0,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
MouseController::process_bluetooth_HID_data 5
  Mouse Data: 02 00 00 00 00 
Mouse: buttons = 0,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
 
The Rii keyboard/mouse may need to be paired with the keyboard object - remember that on my keyboard/mouse Rii i had to type "0000" on the keyboard then it would pair - man memory is getting tougher :)

Think the new 5.0 Techkey may be a problem - may be looking for something that we haven't supported yet.

Did you try putting the dongle into a laptop and try pairing it that way?
 
The Rii keyboard/mouse may need to be paired with the keyboard object - remember that on my keyboard/mouse Rii i had to type "0000" on the keyboard then it would pair - man memory is getting tougher :)

Think the new 5.0 Techkey may be a problem - may be looking for something that we haven't supported yet.

Did you try putting the dongle into a laptop and try pairing it that way?

Yes, no surprise the Rii didn't like mouse - but at least the CSR connected it.

Indeed the TechKey w/Bt 5 is NEW - that was the issue to get to.

My Surface and Desktop have native Bluetooth - Tuening on my old notebook ...

<edit> ... 2011 Laptop booted - running spring 2018 Win 10 - recognized the TechKey dongle - but failed to connect either mouse or the Rii ... doing a restart. It came with a mini CD - it may need custom driver install ...
 
Last edited:
Laptop with TechKey won't see Mouse - or Sense - or logitech K480 keyboard - or Rii bluetooth unit

Putting the CSR dongle on that laptop shows all of those as Found to Pair.

So the problem is the TechKey ... need to return to Amazon ... ready to drop at UPS ...

Thanks @mjs513 ... occurred to me to test - but took motivation for extra effort after seeing the TechKey seemingly recognized by Teensy USBHost ...
 
Last edited:
Going to be interesting. Just reading the reviews and a few people complaint about it not pairing with the PS4 joystick. The very last review in the list was interesting. Seems you have to use there drivers otherwise it’s not working with windows default or Realtek drivers. Just ordered it myself out of curiosity.

Yes the tech key 4.0 worked for us. I have it and it did pair.
 
Could be the dongle is ble?

It is BLE - but as seen - it claims full utility. Did see notes and noted ... 'use their driver' ... figured that would make it not worth the trouble ...

It was so pleasing to see it come up as if ready to use on T_4.1 ... So much for returning it :)

So what is the starting point given it looks like the dongle is online? Maybe it is in BLE mode and the driver has to change that to use normal Bt to pick up those radio messages?
 
It is BLE - but as seen - it claims full utility. Did see notes and noted ... 'use their driver' ... figured that would make it not worth the trouble ...

It was so pleasing to see it come up as if ready to use on T_4.1 ... So much for returning it :)

So what is the starting point given it looks like the dongle is online? Maybe it is in BLE mode and the driver has to change that to use normal Bt to pick up those radio messages?

Could very well be looking for a specific command. Someone identified it as "The dongle identifies as VID_0BDA&PID_8771" Someone else said its a "The adapter has a realtek rtl8761a". Probably start there. @KurtE will probably hook up the LA to it and see if anything pops up.
 
Yep LA, plus plug into Linux and see what it shows... plus google to see if someone has driver...
 
Yep LA, plus plug into Linux and see what it shows... plus google to see if someone has driver...

SYSTEM SUPPORT: Only Win7/Win8/Win8. 1/Win10(need driver), (Not work with Mac OS, Linux,car stereo systems,xbox,ps4 or TVs) support Multi languages
Just thought you should know. Couldn't find much on it.
 
Good thing the LA will work as it only 12 Mbs: "Dual-mode Bluetooth transfer, compatible Full-speed USB 2.0 interface, USB 1.1"

Hopefully Linux function isn't critical to your debug effort KurtE?

I'll get it back in here { from the return pack by the door } on laptop and install the CD driver and see if that makes it work. That old 2011 laptop it seems failed other 6 month Win 10 updates ... it is now 64% complete on the latest one - after 4+ hours ...
 
Good thing the LA will work as it only 12 Mbs: "Dual-mode Bluetooth transfer, compatible Full-speed USB 2.0 interface, USB 1.1"

Hopefully Linux function isn't critical to your debug effort KurtE?

I'll get it back in here { from the return pack by the door } on laptop and install the CD driver and see if that makes it work. That old 2011 laptop it seems failed other 6 month Win 10 updates ... it is now 64% complete on the latest one - after 4+ hours ...

Critical? Not sure. But it arrived and I plugged it into a Ubuntu 18.04 machine to get some data, like:
Code:
kurt@kurt-XPS-8300:~$ lsusb
Bus 002 Device 003: ID 18e3:9106 Fitipower Integrated Technology Inc 
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 05e3:0612 Genesys Logic, Inc. 
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 007: ID 0bda:8771 Realtek Semiconductor Corp. 
Bus 003 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 045e:07a5 Microsoft Corp. Wireless Receiver 1461C
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
kurt@kurt-XPS-8300:~$ lsusb -v -d 0bda:8771 

Bus 003 Device 007: ID 0bda:8771 Realtek Semiconductor Corp. 
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          224 Wireless
  bDeviceSubClass         1 Radio Frequency
  bDeviceProtocol         1 Bluetooth
  bMaxPacketSize0        64
  idVendor           0x0bda Realtek Semiconductor Corp.
  idProduct          0x8771 
  bcdDevice            2.00
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          177
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               1
kurt@kurt-XPS-8300:~$
And see what system messages were generated...
Code:
kurt@kurt-XPS-8300:~$ dmesg | tail -40
[   30.801989] wlp2s0b1: send auth to 14:91:82:a1:0d:bb (try 1/3)
[   30.804056] wlp2s0b1: authenticated
[   30.808047] wlp2s0b1: associate with 14:91:82:a1:0d:bb (try 1/3)
[   30.815531] wlp2s0b1: RX AssocResp from 14:91:82:a1:0d:bb (capab=0x1431 status=0 aid=2)
[   30.816127] brcmsmac bcma0:1: brcmsmac: brcms_ops_bss_info_changed: associated
[   30.816130] brcmsmac bcma0:1: brcms_ops_bss_info_changed: qos enabled: true (implement)
[   30.816136] wlp2s0b1: associated
[   30.823518] brcmsmac bcma0:1: wl0: brcms_c_d11hdrs_mac80211:  txop exceeded phylen 159/256 dur 1778/1504
[   30.838040] brcmsmac bcma0:1: wl0: brcms_c_d11hdrs_mac80211:  txop exceeded phylen 137/256 dur 1602/1504
[   30.847614] wlp2s0b1: Limiting TX power to 30 (30 - 0) dBm as advertised by 14:91:82:a1:0d:bb
[   30.847790] IPv6: ADDRCONF(NETDEV_CHANGE): wlp2s0b1: link becomes ready
[   34.586492] brcmsmac bcma0:1: brcms_ops_bss_info_changed: arp filtering: 1 addresses (implement)
[   64.596024] rfkill: input handler disabled
[   96.754174] usb 3-3.2: USB disconnect, device number 6
[   96.754247] xpad 3-3.2:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -19
[  100.323613] brcmsmac bcma0:1: wl0: brcms_c_d11hdrs_mac80211:  txop exceeded phylen 153/256 dur 1730/1504
[  101.003035] usb 3-3.3: new full-speed USB device number 7 using xhci_hcd
[  101.108817] usb 3-3.3: New USB device found, idVendor=0bda, idProduct=8771
[  101.108821] usb 3-3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  101.108823] usb 3-3.3: Product: Bluetooth Radio
[  101.108825] usb 3-3.3: Manufacturer: Realtek
[  101.108826] usb 3-3.3: SerialNumber: 00E04C239987
[  101.184168] Bluetooth: Core ver 2.22
[  101.184185] NET: Registered protocol family 31
[  101.184186] Bluetooth: HCI device and connection manager initialized
[  101.184190] Bluetooth: HCI socket layer initialized
[  101.184192] Bluetooth: L2CAP socket layer initialized
[  101.184198] Bluetooth: SCO socket layer initialized
[  101.231501] usbcore: registered new interface driver btusb
[  101.232911] Bluetooth: hci0: rtl: examining hci_ver=0a hci_rev=000b lmp_ver=0a lmp_subver=8761
[  101.232914] Bluetooth: hci0: rtl: loading rtl_bt/rtl8761a_config.bin
[  101.250752] bluetooth hci0: Direct firmware load for rtl_bt/rtl8761a_config.bin failed with error -2
[  101.250755] Bluetooth: hci0: rtl: loading rtl_bt/rtl8761a_fw.bin
[  101.263953] Bluetooth: hci0: rom_version status=0 version=1
[  101.263957] Bluetooth: hci0: cfg_sz 0, total size 20204
[  101.454342] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  101.454344] Bluetooth: BNEP filters: protocol multicast
[  101.454347] Bluetooth: BNEP socket layer initialized
[  103.450956] Bluetooth: hci0: command 0xfc20 tx timeout
[  111.578782] Bluetooth: hci0: download fw command failed (-110)
kurt@kurt-XPS-8300:~$
Now to see if any of this makes sense and are there drivers for this realtek device?
 
Another quick update on data from this device. Plugged into T4.1 with debug stuff turned on JoystickBT...
Code:
USB Host Testing

960

USB2 PLL running

 reset waited 6

USBHS_ASYNCLISTADDR = 0

USBHS_PERIODICLISTBASE = 20008000

periodictable = 20008000

port change: 10001803

    connect

  begin reset

port change: 10001005

  port enabled

  end recovery

new_Device: 12 Mbit/sec

new_Pipe

enumeration:

enumeration:

enumeration:

Device Descriptor:

  12 01 10 01 E0 01 01 40 DA 0B 71 87 00 02 01 02 03 01 

    VendorID = 0BDA, ProductID = 8771, Version = 0200

    Class/Subclass/Protocol = 224 / 1 / 1

    Number of Configurations = 1

enumeration:

enumeration:

Manufacturer: Realtek

enumeration:

Product: Bluetooth Radio

enumeration:

Serial Number: 00E04C239987

enumeration:

Config data length = 177

enumeration:

Configuration Descriptor:

  09 02 B1 00 02 01 00 E0 FA 

    NumInterfaces = 2

    ConfigurationValue = 1

  09 04 00 00 03 E0 01 01 04 

    Interface = 0

    Number of endpoints = 3

    Class/Subclass/Protocol = 224 / 1 / 1

  07 05 81 03 10 00 01 

    Endpoint = 1 IN

    Type = Interrupt

    Max Size = 16

    Polling Interval = 1

  07 05 02 02 40 00 00 

    Endpoint = 2 OUT

    Type = Bulk

    Max Size = 64

    Polling Interval = 0

  07 05 82 02 40 00 00 

    Endpoint = 2 IN

    Type = Bulk

    Max Size = 64

    Polling Interval = 0

  09 04 01 00 02 E0 01 01 04 

    Interface = 1

    Number of endpoints = 2

    Class/Subclass/Protocol = 224 / 1 / 1

  07 05 03 01 00 00 01 

    Endpoint = 3 OUT

    Type = Isochronous

    Max Size = 0

    Polling Interval = 1

  07 05 83 01 00 00 01 

    Endpoint = 3 IN

    Type = Isochronous

    Max Size = 0

    Polling Interval = 1

  09 04 01 01 02 E0 01 01 04 

    Interface = 1

    Number of endpoints = 2

    Class/Subclass/Protocol = 224 / 1 / 1

  07 05 03 01 09 00 01 

    Endpoint = 3 OUT

    Type = Isochronous

    Max Size = 9

    Polling Interval = 1

  07 05 83 01 09 00 01 

    Endpoint = 3 IN

    Type = Isochronous

    Max Size = 9

    Polling Interval = 1

  09 04 01 02 02 E0 01 01 04 

    Interface = 1

    Number of endpoints = 2

    Class/Subclass/Protocol = 224 / 1 / 1

  07 05 03 01 11 00 01 

    Endpoint = 3 OUT

    Type = Isochronous

    Max Size = 17

    Polling Interval = 1

  07 05 83 01 11 00 01 

    Endpoint = 3 IN

    Type = Isochronous

    Max Size = 17

    Polling Interval = 1

  09 04 01 03 02 E0 01 01 04 

    Interface = 1

    Number of endpoints = 2

    Class/Subclass/Protocol = 224 / 1 / 1

  07 05 03 01 19 00 01 

    Endpoint = 3 OUT

    Type = Isochronous

    Max Size = 25

    Polling Interval = 1

  07 05 83 01 19 00 01 

    Endpoint = 3 IN

    Type = Isochronous

    Max Size = 25

    Polling Interval = 1

  09 04 01 04 02 E0 01 01 04 

    Interface = 1

    Number of endpoints = 2

    Class/Subclass/Protocol = 224 / 1 / 1

  07 05 03 01 21 00 01 

    Endpoint = 3 OUT

    Type = Isochronous

    Max Size = 33

    Polling Interval = 1

  07 05 83 01 21 00 01 

    Endpoint = 3 IN

    Type = Isochronous

    Max Size = 33

    Polling Interval = 1

  09 04 01 05 02 E0 01 01 04 

    Interface = 1

    Number of endpoints = 2

    Class/Subclass/Protocol = 224 / 1 / 1

  07 05 03 01 31 00 01 

    Endpoint = 3 OUT

    Type = Isochronous

    Max Size = 49

    Polling Interval = 1

  07 05 83 01 31 00 01 

    Endpoint = 3 IN

    Type = Isochronous

    Max Size = 49

    Polling Interval = 1

enumeration:

USBHub memory usage = 960

USBHub claim_device this=20005580

USBHub memory usage = 960

USBHub claim_device this=20005940

HIDParser claim this=20003CC0

HIDParser claim this=200042E0

HIDParser claim this=20005DA0

HIDParser claim this=20004920

HIDParser claim this=20004F40

JoystickController claim this=20006BA0

BluetoothController claim this=20006480

BluetoothController claim this=20006480 vid:pid=bda:8771
    9 4 0 0 3 e0 1 1 4 7 5 81 3 10 0 1 7 5 2 2 40 0 0 7 5 82 2 40 0 0 9 4 1 0 2 e0 1 1 4 7 5 3 1 0 0 1 7 5 83 1 0 0 1 9 4 1 1 2 e0 1 1 4 7 5 
    3 1 9 0 1 7 5 83 1 9 0 1 9 4 1 2 2 e0 1 1 4 7 5 3 1 11 0 1 7 5 83 1 11 0 1 9 4 1 3 2 e0 1 1 4 7 5 3 1 19 0 1 7 5 83 1 19 0 1 9 4 1 4 2 e0 
    1 1 4 7 5 3 1 21 0 1 7 5 83 1 21 0 1 9 4 1 5 2 e0 1 1 4 7 5 3 1 31 0 1 7 5 83 1 31 0 1 
      rxep=1(16) txep=2(64) rx2ep=2(64)
BluetoothController, rxep=1(16), txep=2(64)

new_Pipe

allocate_interrupt_pipe_bandwidth

 best_bandwidth = 3, at offset = 0, shift= 0

new_Pipe

allocate_interrupt_pipe_bandwidth

 best_bandwidth = 6, at offset = 0, shift= 1

new_Pipe

HCI_RESET called (03 0c 00 )
    control callback (bluetooth) 1

    Control callback (bluetooth): 1 : 3 c 0 
0E 04 03 03 0C 00 

BT rx_data(6): e 4 3 3 c 0 
    Command Completed! 
HCI_WRITE_CLASS_OF_DEV called (24 0c 03 04 08 00 )
    control callback (bluetooth) 3

    Control callback (bluetooth): 3 : 24 c 3 4 8 0 
0E 04 02 24 0C 00 

BT rx_data(6): e 4 2 24 c 0 
    Command Completed! 
HCI_Read_BD_ADDR called (09 10 00 )
    control callback (bluetooth) 4

    Control callback (bluetooth): 4 : 9 10 0 
0E 0A 02 09 10 00 03 3C 80 4C E0 00 

BT rx_data(12): e a 2 9 10 0 3 3c 80 4c e0 0 
    Command Completed! 
   BD Addr 0:e0:4c:80:3c:3
HCI_Read_Local_Version_Information called (01 10 00 )
    control callback (bluetooth) 4

    Control callback (bluetooth): 4 : 1 10 0 
0E 0C 02 01 10 00 0A 0B 00 0A 5D 00 61 87 

BT rx_data(14): e c 2 1 10 0 a b 0 a 5d 0 61 87 
    Command Completed! 
    Local Version: a
HCI_WRITE_SCAN_ENABLE called(1a 0c 01 02 )
    control callback (bluetooth) 0

    Control callback (bluetooth): 0 : 1a c 1 2 
0E 04 02 1A 0C 00 

BT rx_data(6): e 4 2 1a c 0 
    Command Completed! 
Write_Scan_enable Completed
*** Device Bluet bda:8771 - connected ***
  manufacturer: Realtek
  product: Bluetooth Radio
  Serial: 00E04C239987
  BDADDR: 3:3c:80:4c:e0:0
 
Good Noon, @mjs513 and @defragster ...

Was not sure if better here or in Joystick thread... But I am trying to see if I can capture the cases where sometimes PS4 joystick works and other times not... Often times if I turn on debug output to USB, it mostly works, so wondered about capturing the data without using USB.

So I hacked up a new class at the start of USBHost_t36 (only on T41) and only if option turned on. that creates a MemoryStream that I then setup the output to go to that instead of Serial.
I also updated the Host Viewer sketch with some real quick and dirty Serial monitor commands, like dump the data that was captured to the Serial port. Or clear out data ...

If anyone is interested the current class looks like:
Code:
#define USBHOST_DEGUG_MEMORY_STREAM
#ifdef USBHOST_DEGUG_MEMORY_STREAM
#if defined(ARDUINO_TEENSY41) && defined(USBHOST_PRINT_DEBUG)
class DebugMemoryStream : public Stream {
public: 
	DebugMemoryStream(uint8_t *buffer, uint32_t size_buffer) : _buffer(buffer), _size_buffer(size_buffer) {}

	// From Stream
	virtual int available() {
		if (_head <= _tail) return _tail - _head;
		return (_size_buffer - _head) + _tail; 
	}
	virtual int read() {
		if (_head == _tail) return -1;
		int return_value = _buffer[_head++];
		if (_head == _size_buffer) _head = 0;
		return return_value;
	}

	virtual int peek() {
		if (_head == _tail) return -1;
		return _buffer[_head];
	}

	// From Print will use default except for one byte version
	using Print::write; 
	virtual size_t write(uint8_t b) {
		if (!_enable_writes) return 0; // not writing now
		uint32_t tail = _tail;
		if (++tail == _size_buffer) tail = 0;
		if (tail == _head) {
			if (_stop_writes_on_overflow) return 0; // no room - if keep first received data
			else if (++_head == _size_buffer) _head = 0;
		}
		_buffer[_tail] = b; 
		_tail = tail; // 
		return 1;
	}

	virtual int availableForWrite(void) {
		return _size_buffer - available();
	}

	// other specific functions
	void enable(bool enable_writes) {_enable_writes = enable_writes;}
	void stopWritesOnOverflow(bool fStop) {_stop_writes_on_overflow = fStop;}
	void clear() {_head = _tail = 0; }

private:
	uint8_t 	*_buffer;  // The buffer
	uint32_t	_size_buffer;
	uint32_t	_tail = 0;	// next plact to write to.
	uint32_t	_head = 0;	// next place to read from. 
	bool		_enable_writes = true;	// by default we are enabled
	bool  		_stop_writes_on_overflow = false; // If we fill buffer to we keep the first bytes or overwrite those... 
};

extern DebugMemoryStream USBHostDebugStream;
#define USBHDBGSerial  USBHostDebugStream


#else
#undef USBHOST_DEGUG_MEMORY_STREAM
#endif
#endif
I have a case where it looked like it did connect, but no data was being outputs, so I did the dump and it printed...
Code:
*** Save first received debug bytes ***

*** BTHID Device joystick 0:0 - connected ***

 *** dump the USBHost Debug data ***

04 0A 97 A2 6C 68 AF DC 08 25 00 01 

BT rx_data(12): 4 a 97 a2 6c 68 af dc 8 25 0 1 
    Event: Incoming Connect -  97:a2:6c:68:af:dc CL:2508 LT:1
      Peripheral device
        Gamepad
BluetoothController::find_driver  driver 20006318
Keyboard Controller::claim_bluetooth - Class 2508
  driver 200065b8
Keyboard Controller::claim_bluetooth - Class 2508
  driver 20006190
MouseController Controller::claim_bluetooth - Class 2508
  driver 20009098
JoystickController::claim_bluetooth TRUE
    *** Claimed ***
HCI_OP_REMOTE_NAME_REQ called (19 04 0a 97 a2 6c 68 af dc 01 00 00 00 )
    control callback (bluetooth) 0

    Control callback (bluetooth): 0 : 19 4 a 97 a2 6c 68 af dc 1 0 0 0 
0F 04 00 01 19 04 

BT rx_data(6): f 4 0 1 19 4 
    Command 419 Status 0
07 FF 00 97 A2 6C 68 AF DC 57 69 72 65 6C 65 73 

BT rx_data(16): 7 ff 0 97 a2 6c 68 af dc 57 69 72 65 6c 65 73 
73 20 43 6F 6E 74 72 6F 6C 6C 65 72 00 00 00 00 

BT rx_data(16): 73 20 43 6f 6e 74 72 6f 6c 6c 65 72 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

BT rx_data(16): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
00 

BT rx_data(1): 0 
    Event: handle_hci_remote_name_complete(0)
    Remote Name: Wireless Controller
  JoystickController::mapNameToJoystickType Wireless Controller - set to PS4
  Joystick Type: 2
HCI_OP_ACCEPT_CONN_REQ called (09 04 07 97 a2 6c 68 af dc 00 )
    control callback (bluetooth) 0

    Control callback (bluetooth): 0 : 9 4 7 97 a2 6c 68 af dc 0 
0F 04 00 01 09 04 

BT rx_data(6): f 4 0 1 9 4 
    Command 409 Status 0
12 08 00 97 A2 6C 68 AF DC 00 

BT rx_data(10): 12 8 0 97 a2 6c 68 af dc 0 
03 0B 00 48 00 97 A2 6C 68 AF DC 01 00 

BT rx_data(13): 3 b 0 48 0 97 a2 6c 68 af dc 1 0 
    Connection Complete - ST:0 LH:48
   Needs connect to device(PS4?)
ConnectionRequest called(48 20 0c 00 08 00 01 00 02 00 04 00 11 00 72 00 )
    tx_data(bluetooth) 0

tx_data callback (bluetooth): 0 : 48 20 c 0 8 0 1 0 2 0 4 0 11 0 72 0 
20 07 97 A2 6C 68 AF DC 01 

BT rx_data(9): 20 7 97 a2 6c 68 af dc 1 
1B 03 48 00 05 

BT rx_data(5): 1b 3 48 0 5 

=====================
BT rx2_data(20): 48 20 10 0 c 0 1 0 3 0 8 0 40 0 72 0 1 0 2 0 
    L2CAP Connection Response: ID: 0, Dest:40, Source:72, Result:1, Status: 2
13 05 01 48 00 01 00 

BT rx_data(7): 13 5 1 48 0 1 0 
17 06 97 A2 6C 68 AF DC 

BT rx_data(8): 17 6 97 a2 6c 68 af dc 
    Event: Link Key Request 97:a2:6c:68:af:dc
HCI_LINK_KEY_NEG_REPLY called (0c 04 06 97 a2 6c 68 af dc )
    control callback (bluetooth) 78

    Control callback (bluetooth): 120 : c 4 6 97 a2 6c 68 af dc 
0E 0A 01 0C 04 00 97 A2 6C 68 AF DC 

BT rx_data(12): e a 1 c 4 0 97 a2 6c 68 af dc 
    Command Completed! 

=====================
BT rx2_data(16): 48 20 c 0 8 0 1 0 2 1 4 0 1 0 41 0 
    L2CAP Connection Request: ID: 1, PSM: 1, SCID: 41
16 06 97 A2 6C 68 AF DC 

BT rx_data(8): 16 6 97 a2 6c 68 af dc 
    Event: Pin Code Request 97:a2:6c:68:af:dc
HCI_PIN_CODE_REPLY called (0d 04 17 97 a2 6c 68 af dc 04 30 30 30 30 00 00 00 00 00 00 00 00 00 00 00 00 )
    control callback (bluetooth) 82

    Control callback (bluetooth): 130 : d 4 17 97 a2 6c 68 af dc 4 30 30 30 30 0 0 0 0 0 0 0 0 0 0 0 0 
0E 0A 01 0D 04 00 97 A2 6C 68 AF DC 

BT rx_data(12): e a 1 d 4 0 97 a2 6c 68 af dc 
    Command Completed! 
18 17 97 A2 6C 68 AF DC 5A A5 7F 22 91 51 2B D5 

BT rx_data(16): 18 17 97 a2 6c 68 af dc 5a a5 7f 22 91 51 2b d5 
0A 3A 5C D0 CE AA 36 69 00 

BT rx_data(9): a 3a 5c d0 ce aa 36 69 0 
    Event: Link Key Notificaton 97:a2:6c:68:af:dc Type:0
    key:5a a5 7f 22 91 51 2b d5 0a 3a 5c d0 ce aa 36 69 
08 04 00 48 00 01 

BT rx_data(6): 8 4 0 48 0 1 

=====================
BT rx2_data(20): 48 20 10 0 c 0 1 0 3 0 8 0 40 0 72 0 0 0 0 0 
    L2CAP Connection Response: ID: 0, Dest:40, Source:72, Result:0, Status: 0

Now to see if any of this makes sense.

If interested, I pushed these changes to branch: BT-Multi-Merge-Debug which is based on my Bt-Multi-Merge branch..
 
Back
Top