-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Advertisement frame with bad parsing ? #14
Comments
I think you are right, it's probably a parsing bug that I already know about, but forget to fix 🤔 I'll have a look tomorrow (and thanks for the Wireshark trace) |
Hi! I see stopping of the advertisement messages on many devices now with ToolBLEx but not with WireShark in background. I think in order to fix that bug, you'll need WireShark on an OS Win10, so here is what to do to install it easily :
|
Ok so I've looked into this issue and I didn't find anything yet. I also have a LYWSD03MMC with a custom firmware, and testing with Linux and macOS I didn't see a parsing problem. I thought it could be an old issue but turns out it was actually fixed. I don't have a Windows to test that today, but I'll look into it if I can. I have a similar problem with my Linux install as I previously mentioned, but looking deeper into it, I can see that the application probably isn't the problem. When I loose Bluetooth after a couple seconds of parsing, I can see that BLE traffic completely stop with Wireshark too. And it does not appear to happen mid-frame, it's just that no more scan/advertisement events are happening. If I'm already connected to a device, then the connection continue to work as intended and I can read/write to characteristics as long as I want. |
With you new online reports, I think will be able to do more tests to try to understand, expecially with the LYWSD03MMC custom ATC because it's working with advertising frames with data inside (a rare case for BLE devices). Moreover, I will be more precise with the descricption of my tests done next time. |
By the way, just to be sure, the "scanning timeout" setting is set to 0 (unlimited) or to a high enough value, so it's not what's stopping the scanning in your case right? |
Yes, scanning timeout is set to 0 for permanent scanning. Here are my last results with a screenshot at the end :
(Length = 27) Sub Event = 0x02 Event type = 0x04 (Scan response) (Length = 32) Sub Event = 0x02 Event type = x00 (Connectable Undirect Advertising) One good new information : frame packet counter change only if values change ! So it was not a bug in ToolBLEx (sorry :) ) But the main bug is remaining : with ToolBLEx, only one advertising frame is present (with partial datas) : I think parsing is bloquing somewhere (maybe in the "ignoring same frames" code part ?) |
It's weird, I just tested on Windows and nothing seems wrong either. I can get 30m of advertisement from the LYWSD03MMC... |
You see the LYWSD03MMC ATC custom with lots of advertisement frames with temp & humi & batt ? Or only the original Xiaomi LYWSD03MMC ? Because the original Xiaomi don't send advertisement frames with temp & humi & batt, just classic advertisement frames. So I will continue tests with other BLE devices to try to understand with more informations. |
I've understood :) I've decided to use a device with programmable datas in advertising frames (I can change UUID, etc...) : the original breakboard HM-10 (BLE 4.0) Conclusion : the parsing of ToolBLEx adverstising frames is uncomplete compared with the Wireshark parsing, and I think it could be a huge work to do it due to many BLE rules :'( Here is my test screenshot : For example here :
I think the solution for ToolBLEx is to try parsing less with these advertising frames (more RAW data than parsed data) to avoid bad parsing if it's possible (i'm not a BLE specialist, is it possible) ? |
Manufacturer data don't have UUID, they have 32 bits "manufacturer ID".
Incomplete data as you call it is a problem with your Window install, or maybe the relation between your Window and the software, I don't really know at the moment. I certainly don't see it on my computer, which makes it harder to fix... ToolBLEx doesn't parse data, it just prints them in a pretty format. What is logged is the actual size of the data received and the content of the data is just the block of data in hexadecimal format, printed almost as soon as it's received. The applications receive blocks of data from the OS (applications can't do Bluetooth directly). What travels on the air is not what an application will get, the "network transmission" part of the packet will be handled by the OS (that's what you see on the left panel of Wireshark) and the actual payload forwarded to the apps. For instance, a device will advertise its name and data in separate packets, that's how the BLE transmission works, not duplicating the name in each advertisement packet. Yet applications always received "assembled" packets with a device name and data from the OS BLE stack (actually on macOS depending on the SDK version used it's sometime not true, but it remains to be seen if it's a bug or if it is intended). The device in your screenshot seems to be a beacon, that's usually what we see with nameless devices (on Linux they are presented with the MAC in their names, on macOS usually empty names, on Windows "Bluetooth + MAC") so maybe there is just no data in the packet? But in your screenshot we can see the name in the packet payload. So again in this case (the example from the screenshot not the problem described in this issue altogether) I'm really tempted to blame the OS? |
Hi !
This time I think I've found bug : I'm testing with a Xiaomi LYWSD03MMC (this time with an "atc1441 modified version").
Lots of Advertisement frames are missing and often, no one arrive after the first one, which is not the good one (bytes missing in the end).
I've done screenshots of your soft with in the same time WireShark in background.
At the same second : 19:08:01, Wireshark trace 2 Advertisement frames, and your soft only one, I think a truncated one :
Wireshark end frame (show next screenshot) => A4 C1 38 90 EA 05 00 D6 40 44 0B 0D C3 CE
ToolBLEx end frame (show next screenshot) => A4 C1 38 90 EA 05 (8 bytes missing)
Sometimes, ToolBLEx shows the good frame, but if the truncated frame appears, no more Advertisement frames occurs after (but Advertisement frames continue with WireShark).
I think it's a kind of parsing problem, which also block the next treatment (Maybe there is a link with my last Screenshot : another Advertisement frame arriving very close in time ?)
The text was updated successfully, but these errors were encountered: