flipperzero-firmware icon indicating copy to clipboard operation
flipperzero-firmware copied to clipboard

Raw data in .sub-files doesn't always start with a positive integer

Open bartbroere opened this issue 1 year ago • 5 comments

Describe the bug.

When dumping some .sub files using the Sub-GHz > Read Raw function I noticed that sometimes the Raw_Data lines don't start with a positive number, and sometimes they start with two positive numbers.

When reading in the line with Python, this can easily be fixed with something like this, after splitting the line on spaces:

if data[0] > 0 and data[1] > 0:
    data = data[2:]
if data[0] < 0:
    data = data[1:]

However, the documentation of the file format mentions that the values must start with a positive number:

RAW_Data, contains an array of timings, specified in micro seconds. Values must be non-zero, start with a positive number, and interleaved (change sign with each value). Up to 512 values per line. Can be specified multiple times to store multiple lines of data.

Perhaps this can be fixed either in the documentation or in the firmware. I'm happy to help with a pull request if this is indeed a bug (or documentation error).

Reproduction

Sample file:

Filetype: Flipper SubGhz RAW File
Version: 1
Frequency: 433920000
Preset: FuriHalSubGhzPresetOok650Async
Protocol: RAW
RAW_Data: 63293 18033 -19558 659 -1458 119225 ...
RAW_Data: -18560 295 -558 295 -598 577 ...

I have truncated the lines, but the pattern continues with the alternating sign.

Target

No response

Logs

No response

Anything else?

No response

bartbroere avatar Jan 06 '23 13:01 bartbroere

Looks like some incorrectly handled counter overflow. I'll check our code.

skotopes avatar Jan 06 '23 13:01 skotopes

Can you provide full file and firmware version that was used to record it?

skotopes avatar Jan 06 '23 15:01 skotopes

Last time I checked I was running the latest stable firmware, somewhere earlier this week. I'm on my phone now, so I can't find the exact version immediately.

I'll do that as soon as possible.

This is the best way I can share the entire file from my phone:

Filetype: Flipper SubGhz RAW File
Version: 1
Frequency: 433920000
Preset: FuriHalSubGhzPresetOok650Async
Protocol: RAW
RAW_Data: 158 33827 -10680 165 -464 197 -432 1589 -266 97 -366 163 -66 187459 -12300 725 -398 163 -132 227 -100 261 -66 229 -98 565 -100 99 -198 1785 -12216 131 -264 65 -100 131 -364 65 -198 427 -164 97 -132 131 -164 163 -66 65 -66 263 -64 97 -198 87831 -11282 99 -656 463 -496 97 -332 165 -198 297 -232 231 -166 67 -132 99 -132 41853 -12092 165 -100 263 -66 131 -360 197 -394 65 -264 229 -134 65 -166 429 -200 229 -66 129 -298 97 -262 163 -66 1249 -98 47725 -9706 99 -262 133 -232 99 -168 265 -166 65 -132 131 -68 197 -134 295 -98 529 -98 361 -100 327 -130 97 -66 1581 -10400 97 -568 821 -660 65 -498 263 -100 97 -198 131 -164 263 -100 361 -98 261 -164 30757 -12342 65 -164 65 -196 757 -362 97 -100 97 -230 165 -296 131 -230 263 -330 163 -66 65 -130 917 -100 1117 -12154 133 -66 197 -132 199 -100 467 -132 67 -266 297 -198 131 -100 131 -100 265 -132 20109 -10106 65 -1514 195 -166 65 -100 97 -1328 495 -200 231 -68 495 -200 65 -596 1985 -594 621 -264 629 -310 583 -314 275 -600 603 -318 597 -288 283 -606 609 -302 595 -304 315 -574 605 -296 305 -618 279 -600 327 -576 317 -600 287 -614 585 -308 595 -296 603 -318 285 -600 617 -292 597 -30928 337 -552 633 -288 605 -284 617 -314 287 -592 621 -284 585 -316 323 -562 615 -314 583 -318 287 -600 613 -276 321 -584 317 -568 321 -608 319 -560 313 -600 611 -314 589 -284 633 -276 325 -558 627 -284 619 -30908 355 -560 631 -258 633 -284 619 -278 321 -596 583 -314 593 -316 287 -600 613 -276 619 -284 323 -570 611 -304 317 -576 297 -594 343 -584 277 -598 329 -578 611 -302 593 -304 615 -284 307 -598 599 -318 601 -30908 317 -624 547 -376 525 -362 565 -348 243 -622 583 -330 569 -348 247 -634 581 -336 577 -316 281 -600 579 -342 281 -622 275 -598 289 -618 317 -592 273 -630 583 -312 589 -314 599 -290 283 -638 575 -310 593 -30946 315 -620 575 -342 557 -328 567 -350 243 -634 581 -336 543 -348 281 -598 581 -340 577 -316 281 -598 581 -342 281 -622 277 -596 291 -620 315 -578 309 -594 589 -314 579 -316 599 -302 315 -588 601 -294 601 -30936 329 -580 615 -312 595 -290 595 -318 287 -598 617 -290 595 -318 287 -598 587 -292 621 -318 287 -598 589 -290 323 -612 283 -596 307 -594 293 -606 319 -594 589 -290 619 -318 593 -312 287 -594 589 -314 581 -30944 313 -584 603 -292 601 -316 583 -316 321 -564 613 -312 585 -318 287 -568 609 -306 617 -284 323 -570 609 -304 313 -586 311 -600 295
RAW_Data: -578 317 -600 287 -614 613 -276 593 -298 603 -320 273 -598 625 -284 605 -30884 387 -558 585 -316 581 -316 601 -288 315 -576 611 -312 593 -294 297 -584 609 -310 593 -296 301 -622 575 -310 305 -600 311 -592 317 -564 309 -594 293 -606 611 -314 593 -290 593 -320 289 -578 617 -292 599 -30906 327 -580 615 -312 593 -294 593 -318 285 -598 617 -292 591 -318 287 -606 605 -300 577 -318 321 -570 613 -300 311 -590 311 -566 321 -592 317 -600 285 -612 579 -310 597 -294 601 -318 277 -632 591 -318 593 -30914 321 -598 591 -290 611 -284 617 -312 287 -596 587 -316 583 -316 323 -564 613 -312 591 -282 323 -570 609 -306 319 -592 319 -570 293 -602 313 -596 315 -566 611 -306 617 -284 607 -310 271 -604 613 -318 599 -30942 319 -586 613 -280 629 -258 621 -320 289 -580 615 -294 599 -320 287 -580 617 -292 599 -318 289 -602 587 -292 321 -578 317 -598 311 -594 291 -604 317 -598 589 -290 613 -318 581 -312 287 -594 621 -284 593 -30952 323 -596 593 -290 609 -284 619 -278 321 -596 587 -316 593 -316 287 -600 611 -312 589 -282 325 -570 611 -306 317 -590 319 -564 309 -594 329 -576 319 -578 617 -292 599 -320 579 -312 321 -558 623 -286 617 -30876 343 -592 609 -276 591 -298 605 -318 289 -602 587 -292 619 -320 287 -600 591 -290 613 -284 325 -598 591 -290 317 -576 319 -596 311 -592 291 -600 317 -598 591 -288 613 -284 631 -274 307 -598 611 -286 597 -30890 321 -610 615 -280 597 -290 617 -284 327 -600 591 -290 609 -284 323 -600 591 -288 611 -284 323 -580 603 -294 301 -618 283 -600 309 -594 291 -604 319 -596 589 -290 615 -284 617 -314 287 -594 585 -316 585 -30918 313 -592 605 -266 625 -314 583 -280 309 -600 611 -284 627 -258 323 -580 635 -258 635 -286 309 -600 583 -314 279 -598 321 -590 319 -566 319 -606 319 -568 605 -302 611 -286 599 -288 317 -574 609 -286 627 -30870 291 -598 615 -318 603 -258 633 -284 323 -564 623 -308 591 -300 311 -586 603 -258 637 -284 309 -600 585 -316 277 -600 321 -588 319 -566 319 -606 319 -568 605 -300 613 -286 597 -288 315 -578 613 -300 595 -30890 317 -584 623 -280 597 -290 615 -320 287 -602 589 -288 613 -284 325 -600 591 -288 611 -284 325 -600 591 -288 315 -576 319 -578 345 -558 329 -576 319 -598 591 -288 613 -284 633 -280 325 -562 613 -312 583 -30874 357 -570 615 -298 573 -318 599 -288 315 -574 609 -286 629 -310 285 -606 573 -328 575 -318 275 -630 595 -318 273 -600 293 -602 317 -594 311 -594 289 -598 621
RAW_Data: -278 597 -292 617 -318 289 -578 617 -292 595 -142568 97 -466 131 -632 1293 -98 67 -132 331 -166 427 -66 297 -230 461 -100 197 -100 99 -66 18349 -10428 65 -166 131 -1260 599 -232 165 -100 365 -262 199 -168 99 -134 1353 -100 128837 -12414 165 -98 131 -228 65 -166 65 -926 97 -332 97 -364 165 -198 67 -166 133 -66 131 -12104 229 -852 133 -496 165 -300 131 -530 133 -232 299 -132 65 -132 34439 -12080 97 -302 231 -132 165 -360 99 -556 99 -98 97 -264 97 -862 363 -166 165 -130 1317 -12466 331 -266 133 -100 929 -364 65 -266 65 -68 131 -198 133 -100 67 -98 295 -5966 65 -6192 299 -198 233 -498 131 -198 65 -98 67 -98 99 -98 397 -198 131 -266 595 -66 1093 -132 395 -12474 97 -98 65 -134 165 -132 265 -200 65 -66 165 -132 199 -298 99 -266 131 -164 197 -134 231 -232 155617 -12654 625 -132 529 -198 129 -66 99 -164 295 -100 231 -166 165 -298 199 -332 2119 -14592 97 -1518 165 -332 65 -166 65 -66 1711 -598 619 -310 593 -290 597 -316 283 -596 619 -292 595 -316 285 -596 585 -324 593 -318 285 -596 619 -292 295 -614 281 -628 273 -626 261 -644 281 -592 585 -324 593 -316 575 -342 271 -602 607 -282 601 -30960 325 -578 611 -302 597 -302 611 -284 309 -598 597 -318 569 -292 311 -598 609 -302 595 -306 315 -574 605 -294 305 -618 311 -600 289 -592 317 -600 287 -610 579 -308 597 -294 605 -318 275 -632 595 -318 591 -30916 359 -540 619 -294 595 -318 577 -308 307 -598 611 -284 605 -308 271 -606 611 -316 599 -290 281 -604 621 -312 285 -596 293 -604 317 -594 309 -594 289 -598 611 -312 593 -292 595 -318 287 -596 619 -292 591 -30930 347 -588 605 -290 607 -318 571 -294 309 -594 609 -284 633 -274 319 -604 575 -328 575 -318 285 -600 617 -292 295 -616 283 -606 293 -602 311 -590 315 -600 577 -306 619 -282 607 -292 309 -594 621 -276 597 -30940 321 -604 613 -282 595 -306 615 -284 325 -570 611 -302 615 -286 323 -566 617 -292 599 -320 287 -602 587 -292 319 -580 319 -598 311 -594 291 -600 319 -580 619 -290 591 -318 579 -310 323 -558 625 -284 619 -30908 311 -586 623 -264 627 -274 619 -278 311 -600 609 -278 599 -296 341 -584 603 -288 607 -284 309 -600 587 -314 279 -598 321 -592 319 -566 319 -606 319 -568 605 -302 579 -318 597 -290 315 -576 611 -312 593 -30890 309 -594 597 -318 581 -312 593 -292 295 -584 611 -310 593 -294 303 -618 589 -312 593 -292 295 -618 575 -310 307 -598 311 -590 319 -564 307 -594 295 -606 623 -280 597
RAW_Data: -292 613 -320 289 -600 589 -290 611 -30906 329 -578 611 -312 593 -292 601 -318 289 -610 581 -296 603 -318 289 -602 587 -292 617 -320 289 -600 591 -290 319 -574 319 -598 311 -592 291 -600 319 -596 589 -290 615 -320 579 -314 285 -594 619 -284 595 -30906 303 -586 611 -302 593 -306 615 -286 305 -598 597 -320 567 -294 307 -598 623 -278 597 -290 323 -580 611 -312 323 -558 295 -608 317 -580 311 -594 293 -602 611 -314 591 -290 595 -318 289 -578 615 -294 603 -30908 291 -604 613 -312 593 -292 593 -318 289 -598 587 -292 619 -320 289 -598 589 -292 615 -284 323 -582 619 -290 293 -614 285 -598 309 -594 291 -602 319 -596 591 -290 613 -284 631 -278 323 -564 613 -312 583 -30912 341 -554 611 -310 593 -296 601 -320 287 -602 589 -290 617 -318 289 -600 591 -290 613 -320 289 -600 589 -290 315 -576 319 -598 309 -594 289 -600 319 -578 619 -290 593 -320 597 -278 323 -594 583 -314 583 -30914 301 -584 635 -258 635 -284 607 -292 307 -590 611 -304 595 -300 313 -586 601 -288 609 -284 325 -580 619 -258 325 -582 317 -598 311 -592 291 -600 319 -596 591 -290 611 -284 629 -280 323 -564 613 -312 583 -30892 343 -592 607 -266 625 -312 583 -284 305 -598 603 -318 599 -290 313 -572 611 -300 595 -304 317 -574 603 -296 337 -588 285 -598 311 -594 291 -602 317 -598 589 -290 611 -284 631 -280 323 -562 613 -314 583 -30910 313 -586 603 -288 613 -284 615 -314 287 -596 585 -316 583 -316 323 -562 613 -312 591 -284 323 -570 609 -304 315 -592 317 -564 309 -594 295 -604 317 -596 591 -290 613 -320 593 -280 323 -562 615 -314 591 -30890 345 -588 607 -274 625 -298 575 -320 323 -564 617 -290 591 -318 275 -598 625 -284 617 -280 323 -594 581 -314 323 -562 313 -600 287 -610 319 -582 311 -560 615 -314 583 -316 601 -288 313 -572 625 -276 629 -30908 309 -594 599 -320 593 -280 599 -290 319 -578 609 -310 593 -296 305 -588 609 -310 593 -296 339 -588 575 -310 307 -598 313 -592 317 -564 345 -556 331 -576 623 -274 625 -298 609 -286 307 -598 595 -320 567 -30934 321 -610 587 -316 601 -288 611 -284 323 -582 619 -290 591 -320 287 -602 589 -290 617 -320 287 -580 617 -292 299 -616 321 -564 307 -594 295 -604 317 -598 591 -288 613 -320 579 -314 285 -594 621 -284 619 -30908 313 -594 603 -310 591 -302 611 -286 323 -568 617 -290 593 -320 287 -602 587 -292 617 -320 287 -602 589 -290 319 -578 317 -598 311 -594 291 -598 319 -596 591 -290 613 -320 577 -284 309 -610 615
RAW_Data: -280 597 -30934 323 -596 611 -284 627 -276 619 -284 307 -598 601 -318 599 -290 281 -604 611 -300 593 -306 319 -574 603 -296 341 -588 283 -600 307 -594 295 -606 319 -596 587 -292 617 -318 579 -310 323 -558 627 -284 629 -30910 357 -564 597 -292 635 -284 593 -314 321 -564 615 -312 583 -314 287 -598 613 -312 583 -314 287 -598 615 -310 285 -584 313 -600 289 -614 317 -594 311 -560 615 -314 589 -318 569 -292 309 -600 623 -312 593 -147452 65 -198 265 -66 297 -502 131 -100 131 -298 165 -330 131 -558 131 -132 97 -98 197 -132 99 -130 263 -98 7943 -12138 197 -132 99 -132 163 -1220 199 -66 367 -100 131 -132 231 -66 131 -100 65 -266 2253 -66 35791 -12070 99 -100 231 -166 99 -98 199 -130 295 -198 231 -164 65 -66 297 -66 133 -364 331 -132 1249 -100 38773 -12138 65 -66 199 -132 199 -628 65 -134 263 -164 99 -132 197 -400 65 -398 331 -330 1193 -134 765 -66 20745 -4196 529 -168 397 -100 465 -364 299 -166 133 -462 99 -298 163 -298 165 -64 1909 -98 11081 -11974 297 -132 197 -98 67 -66 197 -134 97 -132 233 -66 267 -298 263 -166 99 -234 1881 -66 77385 -10002 65 -1288 99 -534 65 -498 265 -694 299 -266 63 -362 427 -364 97 -100 65 -200 165 -530 25503 -7206 65 -4482 65 -394 65 -98 163 -130 131 -196 163 -530 265 -796 65 -132 99 -232 133 -198 233 -764 693 -98 1047 -100 29541 -12508 201 -698 297 -396 65 -100 99 -1194 65 -166 197 -134 99 -100 335 -232 58123 -9804 65 -500 65 -766 265 -132 131 -496 165 -266 363 -198 195 -68 163 -68 165 -132 265 -164 67 -632 2309 -132 157715 -11458 99 -166 397 -132 97 -98 99 -66 65 -64 99 -132 131 -164 65 -296 331 -132 67 -132 233 -232 197 -366 597 -68 197 -200 7069 -5870 133 -764 263 -1250 229 -394 65 -164 97 -134 97 -68 131 -202 265 -134 229 -598 599 -68 431 -5050 65 -6992 63 -98 65 -166 97 -232 65 -396 131 -560 265 -132 231 -298 233 -366 199 -132 231 -266 1163 -66 36719 -11834 99 -232 429 -132 131 -98 99 -198 265 -400 165 -362 65 -100 395 -130 593 -98 131 -132 5841 -11214 163 -100 65 -100 199 -566 131 -132 201 -134 131 -66 65 -132 65 -532 563 -238 21839 -12162 67 -266 131 -66 233 -100 297 -98 131 -230 557 -328 131 -164 65 -560 327 -66 89251 -12038 63 -98 99 -164 65 -98 163 -132 65 -132 263 -98 427 -98 229 -166 689 -132 955 -100 6323 -10898 129 -658 427 -166 65 -232 65 -100 99 -196 65 -396 293 -890 791 -98 401 -66 8811 -10702 99 -862 65

bartbroere avatar Jan 06 '23 17:01 bartbroere

I notice that it is not the file from the first comment, but it does have the same issue.

bartbroere avatar Jan 06 '23 17:01 bartbroere

Yep, I've reproduced issues. We'll address it in next release.

skotopes avatar Jan 06 '23 17:01 skotopes

We've added couple fixes in 0.77. Please reopen if issue is still persist

skotopes avatar Feb 10 '23 08:02 skotopes