Forum Rule: Always post complete source code & details to reproduce any issue!
Page 37 of 39 FirstFirst ... 27 35 36 37 38 39 LastLast
Results 901 to 925 of 969

Thread: T3.6 USB Host - Bluetooth

  1. #901
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    @KurtE
    Took break to play with PS4 again since I received the new PS4 clone.

    Seems to hang the USBHost_t36 and I have to hit the pgm button to upload the sketch again:
    Code:
    *** Device Bluet a5c:21e8 - connected ***
      manufacturer: Broadcom Corp
      product: BCM20702A0
      Serial: 5CF3707752FD
      BDADDR: fd:52:77:70:f3:5c
    BT rx_data(16): 2f ff 1 d3 eb e7 e9 b6 98 1 0 8 25 0 ed 6c 
    BT rx_data(16): d5 5 3 24 11 0 12 14 9 57 69 72 65 6c 65 73 
    BT rx_data(16): 73 20 43 6f 6e 74 72 6f 6c 6c 65 72 9 10 2 0 
    BT rx_data(16): 4c 5 cc 9 0 1 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 
        Extended Inquiry Result - Count: 1
          BD:d3:eb:e7:e9:b6:98, PS:1, class: 2508
          Local Name: Wireless Controller
          Peripheral device
            Gamepad
    BluetoothController::find_driver  driver 20005a38
        *** Claimed ***
    HCI_INQUIRY_CANCEL called (02 04 00 )
    *** BTHID Device Joystick1 0:0 - connected ***
      product: Wireless Controller
      Serial:  
        Control callback (bluetooth): 100 : 2 4 0 
    BT rx_data(6): e 4 1 2 4 0 
        Command Completed! 
    HCI_CREATE_CONNECTION called (05 04 0d d3 eb e7 e9 b6 98 18 cc 01 00 00 00 00 )
        Control callback (bluetooth): 101 : 5 4 d d3 eb e7 e9 b6 98 18 cc 1 0 0 0 0 
    BT rx_data(6): f 4 0 1 5 4 
        Command 405 Status 0
    BT rx_data(13): 3 b 0 b 0 d3 eb e7 e9 b6 98 1 0 
        Connection Complete - ST:0 LH:b
    HCI_AUTH_REQUESTED called (11 04 02 0b 00 )
        Control callback (bluetooth): 110 : 11 4 2 b 0 
    BT rx_data(6): f 4 0 1 11 4 
        Command 411 Status 0
    BT rx_data(8): 17 6 d3 eb e7 e9 b6 98 
        Event: Link Key Request d3:eb:e7:e9:b6:98
    HCI_LINK_KEY_NEG_REPLY called (0c 04 06 d3 eb e7 e9 b6 98 )
        Control callback (bluetooth): 120 : c 4 6 d3 eb e7 e9 b6 98 
    BT rx_data(12): e a 1 c 4 0 d3 eb e7 e9 b6 98 
        Command Completed! 
    BT rx_data(8): 16 6 d3 eb e7 e9 b6 98 
        Event: Pin Code Request d3:eb:e7:e9:b6:98
    HCI_PIN_CODE_REPLY called (0d 04 17 d3 eb e7 e9 b6 98 04 30 30 30 30 00 00 00 00 00 00 00 00 00 00 00 00 )
        Control callback (bluetooth): 130 : d 4 17 d3 eb e7 e9 b6 98 4 30 30 30 30 0 0 0 0 0 0 0 0 0 0 0 0 
    BT rx_data(12): e a 1 d 4 0 d3 eb e7 e9 b6 98 
        Command Completed! 
    BT rx_data(5): 1b 3 b 0 5 
    BT rx_data(16): 18 17 d3 eb e7 e9 b6 98 ac 17 5c 55 67 e 12 34 
    BT rx_data(9): 30 80 7e ee 22 e7 61 81 0 
        Event: Link Key Notificaton d3:eb:e7:e9:b6:98 Type:0
        key:ac 17 5c 55 67 0e 12 34 30 80 7e ee 22 e7 61 81 
    BT rx_data(5): 6 3 0 b 0 
        Event: HCI Authentication complete(0): handle: b
    ConnectionRequest called(0b 20 0c 00 08 00 01 00 02 00 04 00 11 00 70 00 )
    tx_data callback (bluetooth): 0 : b 20 c 0 8 0 1 0 2 0 4 0 11 0 70 0 
    BT rx_data(7): 13 5 1 b 0 1 0
    dies here.

    With the USBHost shield says its paired but the blue light on the PS4 doesn't stay on (keeps blinking) and no data:
    Code:
    PS4 Bluetooth Library Started
    Bluetooth Dongle Initialized
    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 00:19:86:00:0E:E0
    Please enable discovery of your device
    Gamepad found
    HID device found
    Now just create the instance like so:
    BTHID bthid(&Btd);
    And then press any button on the device
    Remote Name: Wireless Controller
    PS4/PS5 controller is connecting
    Connecting to HID device
    Connected to HID device
    Received Key Request
    Bluetooth pin is set too: 0000
    Pairing successful with HID device
    Send HID Control Connection Request
    stops at send connection request.

  2. #902
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,211
    Oh Boy... More debugging!

  3. #903
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    Quote Originally Posted by KurtE View Post
    Oh Boy... More debugging!
    Have a feeling its all related to the same issue - in otherwords fix one you fix them all

  4. #904
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    @KurtE - you may want to check this link out: https://techtutorialsx.com/2020/02/1...s4-controller/, about setting up the PS4 controller,
    Preparing the controller
    Before we can start using the controller, we need to consider that when a PS4 controller is paired with a console, it means that the controller has stored the Bluetooth MAC address of the console and this is the only device to which the controller will connect to [1].

    So, before we can connect the ESP32 and the PS4 controller, we need to follow one of the following options [1]:

    1. Find out what is the Bluetooth MAC address of the PS4 that is stored on the controller and set the ESP32 address to use that address;
    2. Change the MAC address stored on the controller to the one from the ESP32.


    Independently of which one we choose, the easiest way is to use a tool called SixaxisPairTool, which allows to both get the current MAC address stored on the controller and also set a new value.
    Sound familiar

    EDIT: their library has also implemented a couple of things:
    SPP - we know about this - guess its time,,,,
    and something called:
    This function initialises the required GAP services
    Looks like GAP maybe BLE related:
    Generic Access Profile (GAP)
    There are two mechanisms a BLE device can use to communicate to the outside world: broadcasting or connecting. These mechanisms are subjected to the Generic Access Profile (GAP) guidelines. GAP defines how BLE-enabled devices can make themselves available and how two devices can communicate directly with each other.
    Ref: https://punchthrough.com/how-gap-and-gatt-work/

    EDIT: well just found that classic BT also has a GAP Service
    https://stackoverflow.com/questions/...assic-rssi-fro
    https://github.com/aed3/PS4-esp32
    https://docs.espressif.com/projects/...sp_gap_bt.html
    https://www.bluetooth.com/specificat...ccess-profile/
    Last edited by mjs513; 05-24-2021 at 12:40 AM.

  5. #905
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,211
    Morning all:

    Some of the PS4 documentation stuff, talked about two types of paring. The first to console, which is done by plugging it in and I don't remember if that was automatic or if you had to turn the PS4 on then or ...
    Then the BT way by pressing the share and the PS button until the double blink...

    But as you said looks like maybe going to need to do the SDP stuff, not sure yet about GAP/GATT (Volume 3 section G)

    Not sure if GAP is BLE stuff, maybe used. I think BLE is Volume 6...

    Not sure yet what my highest priority is on this right now:
    a) Probably play a little more with PS3 clone stuff and get a version of Zentas hexapod at least able to move some using Dynamixels, then make version that starts to use the LSS
    b) PS4/Xbox One... SDP stuff...

    Or drink more coffee..

    Probably more coffee

  6. #906
    Hi, dogs who are lost.

    While guys are walking slowly, "USB Host Library 2.0" is supported "Xbox One S Controller", "PS5 Controller" and "Nintendo Switch Pro Controller"
    And even its derivative "USB Host Shield Library 2.0 BTXBOX" is "Nintendo Switch Pro Controller" supported too.

    What are guys missing?
    Let's give you a hint.

    1. "SDP" is a mechanism for inquiring about services used on the device, so it is not always necessary if you already know it like a game controller.
    2. The PS3 controller is old and special, and it is necessary to write the BD address of the host to the game controller by wire, but recent game controllers that can be paired with a PC via Bluetooth should basically implement only "Secure Simple Pairing". It can connect and authenticate.
    3. The device name of the game controller is not so important. This is common with Chinese copy products.

    Bluetooth is simpler than you think.
    Make it appropriate initial settings.
    Then, just handle the event sent from the Bluetooth controller (USB Bluetooth dongle in this case) properly and send the command to Bluetooth controller.

    Why you don't try to read program sources written by others who are already running?
    Why you don't try to read the Bluetooth core specs?
    Everything is written. Just read.
    Just read, research and learn.

    These are what you are missing.

    (Used Google translate)

  7. #907
    Senior Member
    Join Date
    Apr 2020
    Location
    DFW area in Texas
    Posts
    265
    Quote Originally Posted by passerby2021 View Post
    Hi, dogs who are lost.
    (Used Google translate)
    This has me wondering what the original native-language sentence might have been that translated to "Hi, dogs who are lost." !!

    Mark J Culross
    KD5RXT

  8. #908
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,211
    Thanks Passerby...


    Actually we have supported several different controllers and the like with Bluetooth, like PS3 and PS4... For example we do have code built in for PS3, that if you plug it in after we have seen a BT adapter, we can do the work to pair the PS3 to that Bluetooth dongle. We also have code that if you configure the software to enter into Binding mode and for example on PS4 you hold down the share button along with the PS button and it enters into the double blink, the PS4 will hopefully bind... You then reconfigure the software to not be in bind mode and then hopefully after you startup, hitting the PS button will connect. Note Some of this was modeled after thte Host Shield 2 code, where the constructor specified if you we pairing or not... At some point would rather not be this way, but instead call an member function to enter binding mode...

    And we have looked through the USB HostShield 2 code base before. But note: last time through when looking to get the XBoxOne to work, it was also not working on Host Shield 2... There was another branch up there which was a WIP which was not fully functional... So yes will soon compare to see what all they needed to change.

    As we mentioned, Official PS4 is/was working on our library, but we decided to buy a few clones of them, which so far they are not working. @mjs513 also tried couple of them don't appear to work either on the HS2 code base.

    Read code that works: Again as mentioned, Have looked at HS2, plus Linux Drivers, plus... And as mentioned not everything works on HS2 and they probably follow some of the same steps as we do. That is for devices that are not working, try to deduce what that device does when it talks to a PC or to Linux and then figure out what is not implemented that is not needed.

    Read core spec: You mean like the Bluetooth Core Spec V5.0, where my previous message for example mentioned Vol 3 section B for SDP... I have read through many sections of it and do refer to it. But I totally admit that I have not read the full 2822 pages of it.

    But sometimes the main issue is time and energy to do the work. That is most of this work to support anything on Bluetooth has been done by a few us for our own fun. And in most cases everything we have tested it with was purchased out of our own pocket.

    And of course, it would be great if you and/or others would like to help, by contributing code and help debug and the like.

    Again thanks.

  9. #909
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    @KurtE

    For simple pairing: I was searching through the thread where we first talked about implementing it to find the reference. Could find it but did find the reference in my bookmarks. It was the USBHostShield library that was modified by HisashiKato that was eventually incorporated into the official host_shield_2 library: https://github.com/HisashiKato/USB_H...ary_2.0_BTXBOX.

    And before we loose the links he references the following 2 base links for SDP/SPP
    http://www.yts.rdy.jp/pic/GB002/GB002.html

    Here's the whole list of his references in case we loose it:
    Projects and websites that I was able to refer to
    https://github.com/felis/USB_Host_Shield_2.0:home of USB_Host_Shield_2.0
    https://www.silex.jp/blog/wireless/:Blog of Cyrex Technology Co., Ltd., Wireless's Father (Bluetooth Basics)
    http://www.yts.rdy.jp/pic/GB002/GB002.html:YTS's YTS website (SSP details, etc.)
    https://hackaday.io/project/170365-blueretro:Jacques Gagnon's "BlueRetro" (very helpful!!! )
    https://github.com/atar-axis/xpadneo:Advanced Linux Driver for Xbox One Wireless Gamepad
    https://github.com/dekuNukem/Nintend...se_Engineering

    In addition, I add it when I come up with it. It is thanks to everyone that I was able to make it in this way. Thank you very much.
    Looks like this is going to be needed for those PS4 Clones, XBOX and Nintendo controllers as we talked about earlier. Funny that the DS4 Controller we got doesn't need it.

    @passerby2021 - just as a note, in addition, to what @KurtE discussed in his post, the 2 clone controllers do not work with USBHost Shield V2 either.

    Ok @KurtE - back to other distractions.

  10. #910
    I am the author of this library.
    https://github.com/HisashiKato/USB_H...ary_2.0_BTXBOX

    I am a complete amateur.
    It's strange that I can do it and you can't.

    You don't have to read the entire Bluetooth spec. You only have to read the necessary parts.

    All I did was read the source program in the original library and the Bluetooth spec.

    Maybe I only have much less time and less knowledge than you.
    I have beeing ill for a long time. I'm still sick. There is no time, no money, no youth.

    But it was done. Why can't you guys?

    You may need to think about it.

    (Used Google translate)

  11. #911
    I stop talking anymore.
    I go away.
    Good luck.

  12. #912
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,427
    Quote Originally Posted by passerby2021 View Post
    I am the author of this library.
    https://github.com/HisashiKato/USB_H...ary_2.0_BTXBOX

    I am a complete amateur.
    It's strange that I can do it and you can't.

    You don't have to read the entire Bluetooth spec. You only have to read the necessary parts.

    All I did was read the source program in the original library and the Bluetooth spec.

    Maybe I only have much less time and less knowledge than you.
    I have beeing ill for a long time. I'm still sick. There is no time, no money, no youth.

    But it was done. Why can't you guys?

    You may need to think about it.

    (Used Google translate)
    That looks like an interesting library - the link is appreciated.

    The XBOX wasn't a primary concern or focus - but rather other devices were of more interest and more commonly used and more affordable, so the XBOX has been ignored, perhaps your work will inspire development and improvement in overall bluetooth library.

    Thanks for posting with translation - though it surely suffers in translation.

    All the best for your health.

  13. #913
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,211
    @passerby2021 - I am glad you have it working. Also hope you get well soon. And again if you are playing with Teensy boards and with play along that is great.

    As I mentioned when we last looked at supporting the XBox360, no one had a working version of it.

    I see the last update date on the XBOXONE S branch on Host Shield 2 library is dated like 2 years ago. So it has probably been well over a year or so since we looked at it. Not sure when they figured out the last pieces of it. So yes it can be relatively easy to do, when you are following code that works...

    So one of these days (maybe soon) we will take another look at it and see what we need to change to make it work.

    Often time it is not that we can not do it... It is more of a case of wanting to take the time to do it. Of course it helps to know someone figured out the last pieces.

    Again speaking only for myself, I am doing it only for the fun of it. If it is not fun, I will go find something else to spend my free time.

    Again only speaking for myself, it is not the highest priority thing I would like to have working on the Teensy. For example just on the USB hosting code
    I would rather spend my time help to integrate in things like MTP (setup storage that can be seen by a PC). And MSC - The ability to plug in a USB drive and use it on your Teensy.

    Then there are things like helping out on beta versions of products and help them ship. Like the T4 or T4.1 Then there are display drivers, Some cameras to help figure out how to use
    DMA with GPIO, and likewise FlexIO.

    We are mainly looking again at some PS4 clones as we are playing with some robots up on RobotShop and some up there desire to use a PS4 and some others don't want to pay the high price for a real one.
    Real ones are maybe $70-100 and some clones are like $25-35. We only briefly looked at a switch as I think it was @mjs513 picked one up and again it was a clone... So not sure how true it is...

    Now back to playing

  14. #914
    P.S.
    The PS4's original controller (DUALSHOCK 4) supports HOST BD address writing via USB wired connection, old PIN code used pairing, and new SSP pairing.
    Which one will be chosen depends on the host's request.
    may be.

  15. #915
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    Quote Originally Posted by passerby2021 View Post
    I am the author of this library.
    https://github.com/HisashiKato/USB_H...ary_2.0_BTXBOX

    I am a complete amateur.
    It's strange that I can do it and you can't.

    You don't have to read the entire Bluetooth spec. You only have to read the necessary parts.

    All I did was read the source program in the original library and the Bluetooth spec.

    Maybe I only have much less time and less knowledge than you.
    I have beeing ill for a long time. I'm still sick. There is no time, no money, no youth.

    But it was done. Why can't you guys?

    You may need to think about it.

    (Used Google translate)
    @passerby2021
    First I want to say I am sorry that you have been ill for long time and still sick. I pray for a full recovery. No youth - think most of us can understand that as I am not young anymore either. Time seems to go faster the older you get.

    Second - the library you wrote is a great source document and a job very well done. Thank you and glad it got incorporated into the host shield code base. We didn't even discover the issue with SPP until we tried connecting an XBox controller. That was well when we found your library successfully pairing it with the USBHost Shield. I like the one reference you have to http://www.yts.rdy.jp/pic/GB002/GB002.html which I have currently open. Helps me in understanding what was done and how the pieces go together.

    I have very little knowledge but like playing and testing. As for getting SPP incorporated its just that as @KurtE said and @defragster said we are doing this more for the fun and challenge but life and other distractions occur that keeps putting this on the back burner. But maybe its time thanks to you poking us

    The PS4's original controller (DUALSHOCK 4) supports HOST BD address writing via USB wired connection, old PIN code used pairing, and new SSP pairing.
    Which one will be chosen depends on the host's request.
    Thank you for the explanation, it helps with at least my understanding.

    I stop talking anymore.
    I go away.
    Please don't, join the fun if that is what you want to call it.

    Again sincerely hope your health improves.

    Now have to go do chores.

  16. #916
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    @KurtE
    Remember that PS4 developer's wiki we were looking at that is no longer available .. here is the cached version:
    https://cc.bingj.com/cache.aspx?q=ds...1UZeAhvkxBl4Jz

  17. #917
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,211
    Quote Originally Posted by mjs513 View Post
    @KurtE
    Remember that PS4 developer's wiki we were looking at that is no longer available .. here is the cached version:
    https://cc.bingj.com/cache.aspx?q=ds...1UZeAhvkxBl4Jz
    Thanks, good to find a place to get it again.

    For the heck of it I got out my Sparkfun USB Host shield and thought I would try it out again. At first could not get it to work at all. But then went in and changed the setting to not try to use the spi4ateensy code base on it and it started to work. (T3.2)

    With my "Red" clone it connects up when I use the PAIR constructor. But then if I rebuild without the PAIR version... Nothing.

    Then tried to turn on more debug: #define ENABLE_UHS_DEBUGGING 1

    Still did not get much debug information printed. If I remember correctly a lot of this was controlled by: int UsbDEBUGlvl = 0x80;
    I tried to change it to 81... Still not much more... Wonder what setting to maybe see more stuff?

    Actually it is working now??? Maybe it needed a night off
    Code:
    Start of program
    SPI With Transations
    
    PS4 Bluetooth Library Started
    Bluetooth Dongle Initialized
    No response to HCI Reset
    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 00:1A:7D:DA:71:11
    Wait For Incoming Connection Request
    Gamepad is connecting
    Incoming Connection Request
    Remote Name: Wireless Controller
    Connected to Device: 8C:41:F2:DB:38:14
    Received Key Request
    Bluetooth pin is set too: 0000
    HID Control Incoming Connection Request
    HID Control Successfully Configured
    Set protocol mode: 00
    HID Interrupt Incoming Connection Request
    HID Channels Established
    Wait For Incoming Connection Request
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    LeftHatX: 128	LeftHatY: 182	RightHatX: 128	RightHatY: 128
    Would be interesting to see the actual messages... I think previous version I maybe updated code to output more?

  18. #918
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    @KurtE
    Just tried it with my 2 controllers and both still do not connect - tried a couple of different dongles as well. So.....

  19. #919
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,211
    Morning again,

    Playing again a little with the "Red" one (YOYEE) as it looked closest to working... It actually worked when we did a BIND operation, but not without...

    When I captured debug data for the Voyee versus the PS4... I looked at the two using Sublime Merge under Sublime text:
    And some of the initial stuff is the same except for the ID...

    But then diverges:
    Click image for larger version. 

Name:	Screenshot 2021-05-25 083356.jpg 
Views:	13 
Size:	135.5 KB 
ID:	24893

    In both cases we send out a Connection Request
    The next thing back from REAL PS4 is a connection Response...
    From the Voyee we get a request for LINK KEY. Which currently we always return back a negative key reply...

    It looks like from the HS2 it looks like they send a code of:0000

    Will play a little to see what does... (both by experiment and looking at code)...

  20. #920
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    @KurtE
    Good luck. With my 2 PS4 clones it shows Pair successful but no data and then the sketch hangs.

  21. #921
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,211
    Quote Originally Posted by mjs513 View Post
    @KurtE
    Good luck. With my 2 PS4 clones it shows Pair successful but no data and then the sketch hangs.
    I know the feeling...
    I keep adding some more debug output to the USB Host Shield code...

    First I am already outputting the PIN code of 0000
    The next relevant thing I am seeing between our code and HS2 is: handling the Connect/Config...

    That is our code debug output:
    Code:
    =====================
    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(bluetooth) 82
    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 )
    
    =====================
    BT rx2_data(20): 48 20 10 0 c 0 1 0 3 0 8 0 41 0 70 0 0 0 0 0 
        L2CAP Connection Response: ID: 0, Dest:41, Source:70, Result:0, Status: 0
          Control Response
    L2CAP_ConfigRequest called(48 20 10 00 0c 00 01 00 04 02 08 00 41 00 00 00 01 02 ff ff )
    
    =====================
    BT rx2_data(20): 48 20 10 0 c 0 1 0 4 2 8 0 70 0 0 0 1 2 a0 2 
        L2CAP config Request: ID: 2, Dest:70, Flags:0,  Options: 1 2 a0 2
          Control Configuration request
    L2CAP_ConfigResponse called(48 20 12 00 0e 00 01 00 05 02 0a 00 41 00 00 00 00 00 01 02 a0 02 )
        tx_data(bluetooth) 82
    tx_data callback (bluetooth): 202 : 48 20 12 0 e 0 1 0 5 2 a 0 41 0 0 0 0 0 1 2 
    L2CAP_ConfigRequest called(48 20 10 00 0c 00 01 00 04 02 08 00 41 00 00 00 01 02 ff ff )
        tx_data(bluetooth) 82
    tx_data callback (bluetooth): 0 : 48 20 10 0 c 0 1 0 4 2 8 0 41 0 0 0 1 2 ff ff 
        tx_data(bluetooth) 82
    tx_data callback (bluetooth): 0 : 48 20 10 0 c 0 1 0 4 2 8 0 41 0 0 0 1 2 ff ff a0 2 
    13 05 01 48 00 01 00 
    BT rx_data(7): 13 5 1 48 0 1 0 
        tx_data(bluetooth) 82
    tx_data callback (bluetooth): 0 : 48 20 10 0 c 0 1 0 4 2 8 0 41 0 0 0 1 2 ff ff 
    port change: 1C00100A
    Debug output now from HS2:
    Code:
    Ignore HCI Event: 08
    >>(A):48 20 0C 00 08 00 01 00 02 01 04 00 11 00 40 00 
    
    L2CAP Connection Request - PSM: 00 11 SCID: 00 40 Identifier: 01
    HID Control Incoming Connection Request
    <<:48 20 10 00 0C 00 01 00 03 01 08 00 70 00 40 00 01 00 00 00 
    
    <<:48 20 10 00 0C 00 01 00 03 01 08 00 70 00 40 00 00 00 00 00 
    
    <<:48 20 10 00 0C 00 01 00 04 02 08 00 40 00 00 00 01 02 FF FF 
    
    Ignore HCI Event: 08
    Ignore HCI Event: 08
    >>(A):48 20 10 00 0C 00 01 00 04 02 08 00 70 00 00 00 01 02 A0 02 
    
    HID Control Configuration Request
    <<:48 20 12 00 0E 00 01 00 05 02 0A 00 40 00 00 00 00 00 01 02 A0 02 
    
    >>(A):48 20 12 00 0E 00 01 00 05 02 0A 00 70 00 00 00 00 00 01 02 57 FE 
    
    HID Control Configuration Complete
    HID Control Successfully Configured
    Set protocol mode: 00
    <<:48 20 05 00 01 00 40 00 70 
    
    >>(A):48 20 0C 00 08 00 01 00 02 03 04 00 13 00 41 00
    What is interesting is that in both cases:
    The Voyee is sending the connection request (in green)

    In both cases we are sending out Two connection responses with a delay between (first busy then not busy) Blue

    And I am expecting the controller to send a Config Request, and looks like HS2 is sending the Config Request where we diverge... (RED)

    Need to see where they decide to send it...

  22. #922
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    @kurte
    Could wait to see what happened with the debug for USBHost using the blue controller I am not getting the same responses that you are seeing:
    Code:
    *** Device Bluet a5c:21e8 - connected ***
      manufacturer: Broadcom Corp
      product: BCM20702A0
      Serial: 001986000EE0
      BDADDR: e0:e:0:86:19:0
    <<(01):2f ff 1 df 40 7e e9 b6 98 1 0 8 25 0 b6 31 
    <<(01):d6 5 3 24 11 0 12 14 9 57 69 72 65 6c 65 73 
    <<(01):73 20 43 6f 6e 74 72 6f 6c 6c 65 72 9 10 2 0 
    <<(01):4c 5 c4 5 0 1 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):0 
        Extended Inquiry Result - Count: 1
          BD:df:40:7e:e9:b6:98, PS:1, class: 2508
          Local Name: Wireless Controller
          Peripheral device
            Gamepad
    BluetoothController::find_driver  driver 200059f8
        *** Claimed ***
    HCI_INQUIRY_CANCEL
    >>(00):02 04 00 
    *** BTHID Device Joystick1 0:0 - connected ***
      product: Wireless Controller
      Serial:  
        Control callback (bluetooth): 100 : 2 4 0 
    <<(01):e 4 1 2 4 0 
        Command Completed! 
    HCI_CREATE_CONNECTION
    >>(00):05 04 0D DF 40 7E E9 B6 98 18 CC 01 00 00 00 00 
        Control callback (bluetooth): 101 : 5 4 d df 40 7e e9 b6 98 18 cc 1 0 0 0 0 
    <<(01):f 4 0 1 5 4 
        Command 405 Status 0
    <<(01):3 b 0 b 0 df 40 7e e9 b6 98 1 0 
        Connection Complete - ST:0 LH:b
    HCI_AUTH_REQUESTED
    >>(00):11 04 02 0B 00 
        Control callback (bluetooth): 110 : 11 4 2 b 0 
    <<(01):f 4 0 1 11 4 
        Command 411 Status 0
    <<(01):17 6 df 40 7e e9 b6 98 
        Event: Link Key Request df:40:7e:e9:b6:98
    HCI_LINK_KEY_NEG_REPLY
    >>(00):0C 04 06 DF 40 7E E9 B6 98 
        Control callback (bluetooth): 120 : c 4 6 df 40 7e e9 b6 98 
    <<(01):e a 1 c 4 0 df 40 7e e9 b6 98 
        Command Completed! 
    <<(01):16 6 df 40 7e e9 b6 98 
        Event: Pin Code Request df:40:7e:e9:b6:98
    HCI_PIN_CODE_REPLY
    >>(00):0D 04 17 DF 40 7E E9 B6 98 04 30 30 30 30 00 00 00 00 00 00 00 00 00 00 00 00 
        Control callback (bluetooth): 130 : d 4 17 df 40 7e e9 b6 98 4 30 30 30 30 0 0 0 0 0 0 0 0 0 0 0 0 
    <<(01):e a 1 d 4 0 df 40 7e e9 b6 98 
        Command Completed! 
    <<(01):1b 3 b 0 5 
    <<(01):18 17 df 40 7e e9 b6 98 1e 86 f1 f0 5d 3e e2 4b 
    <<(01):61 c2 47 49 33 76 97 8a 0 
        Event: Link Key Notificaton df:40:7e:e9:b6:98 Type:0
        key:1e 86 f1 f0 5d 3e e2 4b 61 c2 47 49 33 76 97 8a 
    <<(01):6 3 0 b 0 
        Event: HCI Authentication complete(0): handle: b
    ConnectionRequest
    >>(02):0B 20 0C 00 08 00 01 00 02 00 04 00 11 00 70 00 
    tx_data callback (bluetooth): 0 : b 20 c 0 8 0 1 0 2 0 4 0 11 0 70 0 
    <<(01):13 5 1 b 0 1 0 
    It dies on that last line from the controller so looks like the controller is requesting something and just waiting for a response?

    Now moving over to the UHS2.0. It dies on the same request:
    Code:
    Class of device: 0C 04 3C
    Number of responses: 1
    Class of device: 0C 04 3C
    <<(01,01F3F82E):02 0F 01 DF 40 7E E9 B6 98 01 00 00 08 25 00 9B 15 
    
    Number of responses: 1
    Class of device: 00 25 08
    Gamepad found
    >>(00,0000003302 04 00 
    
    HID device found
    Now just create the instance like so:
    BTHID bthid(&Btd);
    And then press any button on the device
    >>(00,0000008A19 04 0A DF 40 7E E9 B6 98 01 00 00 00 
    
    Ignore HCI Event: 19
    Ignore HCI Event: 19
    <<(01,000007B4):0F 04 00 01 19 04 
    
    <<(01,000003E8):0E 04 01 02 04 00 
    
    <<(01,0005C119):07 FF 00 DF 40 7E E9 B6 98 57 69 72 65 6C 65 73 73 20 43 6F 6E 74 72 6F 6C 6C 65 72 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 
    
    Remote Name: Wireless Controller
    PS4/PS5 controller is connecting
    <<(01,00000C86):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 
    
    Connecting to HID device
    >>(00,0000004305 04 0D DF 40 7E E9 B6 98 18 CC 01 00 00 00 00 
    
    <<(01,00000D58):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 
    
    <<(01,00000D31):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 
    
    <<(01,00000374):00 
    
    <<(01,000003EE):0F 04 00 01 05 04 
    
    <<(01,0009049F):03 0B 00 0B 00 DF 40 7E E9 B6 98 01 00 
    
    Connection established
    Connected to HID device
    >>(00,0000002E11 04 02 0B 00 
    
    <<(01,000003E0):0F 04 00 01 11 04 
    
    <<(01,000003EA):17 06 DF 40 7E E9 B6 98 
    
    Received Key Request
    >>(00,000000290C 04 06 DF 40 7E E9 B6 98 
    
    <<(01,000003EB):0E 0A 01 0C 04 00 DF 40 7E E9 B6 98 
    
    <<(01,000003E3):16 06 DF 40 7E E9 B6 98 
    
    Bluetooth pin is set too: 0000
    >>(00,0000002B0D 04 17 DF 40 7E E9 B6 98 04 30 30 30 30 00 00 00 00 00 00 00 00 00 00 00 00 
    
    Ignore HCI Event: 0D
    Ignore HCI Event: 0D
    <<(01,00000BBE):0E 0A 01 0D 04 00 DF 40 7E E9 B6 98 
    
    <<(01,0004DE11):1B 03 0B 00 05 
    
    <<(01,000A162E):18 17 DF 40 7E E9 B6 98 FE EC 9F 44 10 26 C9 41 B7 79 92 34 27 5B E8 C2 00 
    
    Ignore HCI Event: 18
    Ignore HCI Event: 18
    <<(01,000003C0):06 03 00 0B 00 
    
    Pairing successful with HID device
    Send HID Control Connection Request
    >>(02,000000250B 20 0C 00 08 00 01 00 02 00 04 00 11 00 70 00 
    
    Pairing was successful
    Pairing was successful
    Pairing was successful
    ........ repeats many times
    Pairing was successful
    Pairing was successful
    <<(01,0003B53B):13 05 01 0B 00 01 00 
    Not really sure what its asking for here? But neither UHS2 or USBHost_t36 seems to cover it.

  23. #923
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    @KurtE
    For the PS4 you might want to take a look for the ESP32, uses both SPP and Classic BT gap:
    https://techtutorialsx.com/2020/02/1...nection-event/
    and his library:
    https://github.com/aed3/PS4-esp32

    It sits on top of the ESP BT stack. But it requires you to use sixaxispair tool and change MAC addresses.

  24. #924
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,211
    @mjs513 - Morning!

    Yes May have to try out some of the ESP32 stuff.

    I believe the last message you are seeing, is a: EV_NUM_COMPLETE_PKT= 0x13
    Which If I remember correctly just says, that a number of packets have been completed. Which we normally ignore.
    In your case:
    Code:
    Pairing successful with HID device
    Send HID Control Connection Request
    >>(02,000000250B 20 0C 00 08 00 01 00 02 00 04 00 11 00 70 00
    That we are asking to pair for the HID case and don't get a response, looks like an issue!

    Which one is this, the newer one you have or the Blue one?

  25. #925
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,200
    Morning @KurtE

    Working with the Blue PS4 - the same one that you have. If that is any help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •