I know that I have mentioned it a couple of times and you are working on an HLA to work with USB captures, I thought I would mention some of it again, as I am right now trying to debug why on a Teensy 4.1 running my latest WIP USBHost library code with Bluetooth support, why sometimes the PS4 works properly when it connects up to the Bluetooth Dongle and other times it does not… It also acts differently when I have Debug output from my library/sketch and when I don’t.
Thought I would mention this again with fresh comments as I am doing stuff.
Things like, I wish the analyzer could make a reasonable guess on if the data is in Low Speed or Full Speed.
So again I started the game of trying to capture using the USB protocol analyzer and then attempt to find the needles in the haystack of data.
The one capture I did was to start sketch, plug in BT dongle, then press the PS button on the Playstation and watch some data come out of it and display in debug terminal…
Saving the capture to disk is about 19mb, I know I don’t need all of it, but really hard to have any idea of where interesting data might be… Note: for most of my cases I have found that outputting to CSV with decode level of packets, has much of the needed data… In this case it generated about 1.9 million lines of text. Again a bit more than what I can easily search through.
From earlier comments up here, I mentioned, I could reduce most of this data down to something more manageable by using a linux grep to find all lines of types (IN, OUT, SETUP), and the line preceding it. In this case it reduced the data down to about 1.9K lines of text, which is nicer. Note Linux added in – type lines between which I edit out, and I use sublime text to combine the two lines of text into one… plus a few other edits to remove multiple commas, and in this case checksum and this reduced the set down to 6465 lines. Turns out the majority of these are the actual Joystick data So really the interesting data that I can use to help deduce all of this to what worked (or in case when it does not) to maybe 300 lines.
Which start off with lines in excel like:
|4.642738992|SETUP|0x00|0x02|0x80 0x06 0x00 0x01 0x00 0x00 0x08 0x00|
|4.8388148|IN|0x00|0x02|0x12 0x01 0x00 0x02 0xE0 0x01 0x01 0x40|
|4.839820056|SETUP|0x00|0x02|0x00 0x05 0x01 0x00 0x00 0x00 0x00 0x00|
|4.84382012|SETUP|0x00|0x1D|0x80 0x06 0x00 0x01 0x00 0x00 0x12 0x00|
|4.84842584|IN|0x00|0x1D|0x12 0x01 0x00 0x02 0xE0 0x01 0x01 0x40 0x12 0x0A 0x01 0x00 0x91 0x88 0x00 0x02 0x00 0x01|
|4.848820208|SETUP|0x00|0x1D|0x80 0x06 0x00 0x03 0x00 0x00 0xFC 0x01|
|4.852926648|IN|0x00|0x1D|0x04 0x03 0x09 0x04|
|4.853820296|SETUP|0x00|0x1D|0x80 0x06 0x02 0x03 0x09 0x04 0xFC 0x01|
|4.85908396|IN|0x00|0x1D|0x18 0x03 0x43 0x00 0x53 0x00 0x52 0x00 0x38 0x00 0x35 0x00 0x31 0x00 0x30 0x00 0x20 0x00 0x41 0x00 0x31 0x00 0x30 0x00|
|4.859820408|SETUP|0x00|0x1D|0x80 0x06 0x00 0x02 0x00 0x00 0x09 0x00|
|4.86397368|IN|0x00|0x1D|0x09 0x02 0xB1 0x00 0x02 0x01 0x00 0xE0 0x32|
|4.864820496|SETUP|0x00|0x1D|0x80 0x06 0x00 0x02 0x00 0x00 0xB1 0x00|
|4.8689618|IN|0x00|0x1D|0x09 0x02 0xB1 0x00 0x02 0x01 0x00 0xE0 0x32 0x09 0x04 0x00 0x00 0x03 0xE0 0x01 0x01 0x00 0x07 0x05 0x81 0x03 0x10 0x00 0x01 0x07 0x05 0x02 0x02 0x40 0x00 0x01 0x07 0x05 0x82 0x02 0x40 0x00 0x01 0x09 0x04 0x01 0x00 0x02 0xE0 0x01 0x01 0x00 0x07 0x05 0x03 0x01 0x00 0x00 0x01 0x07 0x05 0x83 0x01 0x00 0x00 0x01 0x09 0x04|
|4.869012768|IN|0x00|0x1D|0x01 0x01 0x02 0xE0 0x01 0x01 0x00 0x07 0x05 0x03 0x01 0x09 0x00 0x01 0x07 0x05 0x83 0x01 0x09 0x00 0x01 0x09 0x04 0x01 0x02 0x02 0xE0 0x01 0x01 0x00 0x07 0x05 0x03 0x01 0x11 0x00 0x01 0x07 0x05 0x83 0x01 0x11 0x00 0x01 0x09 0x04 0x01 0x03 0x02 0xE0 0x01 0x01 0x00 0x07 0x05 0x03 0x01 0x19 0x00 0x01 0x07 0x05 0x83 0x01|
|4.8690636|IN|0x00|0x1D|0x19 0x00 0x01 0x09 0x04 0x01 0x04 0x02 0xE0 0x01 0x01 0x00 0x07 0x05 0x03 0x01 0x21 0x00 0x01 0x07 0x05 0x83 0x01 0x21 0x00 0x01 0x09 0x04 0x01 0x05 0x02 0xE0 0x01 0x01 0x00 0x07 0x05 0x03 0x01 0x31 0x00 0x01 0x07 0x05 0x83 0x01 0x31 0x00 0x01|
|4.869820576|SETUP|0x00|0x1D|0x00 0x09 0x01 0x00 0x00 0x00 0x00 0x00|
|4.874820664|SETUP|0x00|0x1D|0x20 0x00 0x00 0x00 0x00 0x00 0x03 0x00|
|4.874842136|OUT|0x00|0x1D|0x03 0x0C 0x00|
|4.990745|IN|0x01|0x0B|0x0E 0x04 0x01 0x03 0x0C 0x00|
|4.991745016|SETUP|0x00|0x1D|0x20 0x00 0x00 0x00 0x00 0x00 0x06 0x00|
|4.991766248|OUT|0x00|0x1D|0x24 0x0C 0x03 0x04 0x08 0x00|
|4.992745136|IN|0x01|0x0B|0x0E 0x04 0x01 0x24 0x0C 0x00|
|4.993745152|SETUP|0x00|0x1D|0x20 0x00 0x00 0x00 0x00 0x00 0x03 0x00|
|4.993766352|OUT|0x00|0x1D|0x09 0x10 0x00|
|4.994745072|IN|0x01|0x0B|0x0E 0x0A 0x01 0x09 0x10 0x00 0x13 0x71 0xDA 0x7D 0x1A 0x00|
|4.995745088|SETUP|0x00|0x1D|0x20 0x00 0x00 0x00 0x00 0x00 0x03 0x00|
|4.99576612|OUT|0x00|0x1D|0x01 0x10 0x00|
|4.996745104|IN|0x01|0x0B|0x0E 0x0C 0x01 0x01 0x10 0x00 0x06 0xBB 0x22 0x06 0x0A 0x00 0xBB 0x22|
Which is an improvement over the 1.9 million lines, which I find impossible to search through. First the system does not want to search while it tries to index all of that data.
Again I am not sure how much of this can/should be done at the main USB analyzer code. That is some other method to be able to choose what data you are interested in and which you are not. That is I really wish you can somehow differentiate in the display those sections which show “interesting” data versus “non interesting” stuff like SYNC, Start of frames…
Again I am not sure how much of up to this point should be at the main protocol Analyzer and what should be HLA…
But the next level of stuff I can see that maybe should be HLA stuff is what I am probably going to need to go through next to see what is happening. Which is to translate the some of the above data into the higher level, example the line:
4.874842136 OUT 0x00 0x1D 0x03 0x0C 0x00
Is probably the: HCI_RESET
4.99776636 OUT 0x00 0x1D 0x1A 0x0C 0x01 0x02
Is probably HCI_WRITE_SCAN_ENABLE
Likewise when we receive data back from a device like:
BT rx2_data(20): 48 20 10 0 c 0 1 0 3 0 8 0 40 0 70 0 1 0 2 0
Actually this is debug output from sketch instead of showing the In from 0x02 type line above, but more importantly this actually translates to:
L2CAP Connection Response: ID: 0, Dest:40, Source:70, Result:1, Status: 2
In particular it would be great if the analyzer understood some of the higher level USB standards like HCI and L2CAP.
But another feature that would be great (although not sure how doable it actually would be), is some form of difference of one capture to another. Again may be real difficult, but it would be great if somehow it could say this one is the differences of these two captures have these N HLA messages that are different…
Again sorry I know most of this is just reiterating stuff mentioned earlier.