From d99a059a01b5d0fccceb32ae49f7a49f222e5880 Mon Sep 17 00:00:00 2001 From: Derek Jamison Date: Sat, 2 Sep 2023 19:42:39 -0500 Subject: [PATCH] Fix huge delay on Transmit Signal. --- subghz/apps/rolling-flaws/.flipcorg/README.md | 2 +- .../.flipcorg/gallery/00-about.png | Bin 2179 -> 2185 bytes subghz/apps/rolling-flaws/CHANGELOG.md | 11 +++++++++++ subghz/apps/rolling-flaws/README.md | 2 +- .../apps/rolling-flaws/rolling_flaws_about.h | 2 +- .../rolling-flaws/rolling_flaws_send_keeloq.c | 17 ++++++++--------- 6 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 subghz/apps/rolling-flaws/CHANGELOG.md diff --git a/subghz/apps/rolling-flaws/.flipcorg/README.md b/subghz/apps/rolling-flaws/.flipcorg/README.md index 417d210..e702630 100644 --- a/subghz/apps/rolling-flaws/.flipcorg/README.md +++ b/subghz/apps/rolling-flaws/.flipcorg/README.md @@ -1,6 +1,6 @@ # Rolling Flaws -Rolling Flaws by [@CodeAllNight](https://twitter.com/codeallnight). +Rolling Flaws (version 1.3) by [@CodeAllNight](https://twitter.com/codeallnight). [YouTube demo](https://youtu.be/gMnGuDC9EQo?si=4HLZpkC4XWhh97uQ) of using Rolling Flaws application. The video shows how to use the application to simulate a receiver that has a Replay attack flaw, Pairing FZ to a receiver, Cloning sequence attack, Future attack, Rollback attack & KGB attack. The Rolling Flaws application also supports things like "ENC00" attack & window-next attacks, which are described in scenarios below but was not in video. Rolljam is discussed in document, but discouraged to test since it is [illegal to jam signals](https://www.fcc.gov/general/jammer-enforcement) in the US. If you have additional ideas, please let me know! diff --git a/subghz/apps/rolling-flaws/.flipcorg/gallery/00-about.png b/subghz/apps/rolling-flaws/.flipcorg/gallery/00-about.png index 8caaebe251b6baf25cdc917322ddb07f164fec1e..a5c898cba16cc28839550e4e4c7f1adcc2f764b3 100644 GIT binary patch delta 708 zcmZn`>=c|}S#Ry>;uumf=j~m`NpIA|SOb*qAR(erLJ) zzjKh%k~Pvywx2$qUh@C%xA`|?|6N@F|L|f5DD_$d${$z&s+nc3&>UQPZc=slUz1}{t?A*0AXY!11&y)KsX1VM8bJdo996$AU z+oo@Ut=}ei$}%wU0uA&6dis}yvrPEUxwQ?E^B5SMI0YCQ0)TG15+Lg!^*)9;asbIVi!)$GE+{w|It6JvX05Z9my|NcI*XDXKeb}V6QUY`a}9F z28Il%!6D^*2`RR}CVnmOTW`Pl^^fpvmDBI-xc4TXGsIdyK_4lQUnTz$e{dJc{Tjs# un_n^gV`Pk+{F3E7qx0sStXrAH{xkM>`aJq6-1>|G2s~Z=T-G@yGywpD^)yHT delta 724 zcmeAaY!;kgS#Rp;;uumf=j~m`NpIA|SOb^Hd%lV`IKF`JLtF z|IR^5OV&s;*?#(bdddI4&$r)<{daNw{{P?q%hiATFS(rm`=$9IpKJZgw(ndZ%OIk{ zz~IEm&=6pM|G$Lf?llJ2GJB?G-I*L>{N?+frZR?r2@DJzsz5dMfB$?|`&{*Y{yQmk z*_He+X3l*cVR`O^Vfd}huVegb-sMPF9ba=TU-|8vwUIOLrfsveeWqJf^8UQF6!U?< zEDR1Bj0^&+W-{L}4cooxtlskDS?+7ToSgdmUDoH0*sW@!zutba-Lu;E*squO?8Ub; zHz>ih>=p}XHLVv4segBSs#MddT#H!yLZ_|YKIpt+V94MAI-H3?A*5Va;WOj)6?e9a z-YR~YA29#l9nq_|4sTw;%&ObfG>;^{i2AlNipBA3Ed0+HK>6wX!FNA-83)#^( z^>=RS+r?aO6(?IUFh~InoC5UpSHm`ob)T$%Gidata = NULL; preset->data_size = 0; + SubGhzProtocolEncoderBase* encoder = subghz_transmitter_get_protocol_instance(transmitter); + // sadly, in some firmware this has a Repeat of 100, which is too much for our purposes. + subghz_protocol_keeloq_create_data( - subghz_transmitter_get_protocol_instance(transmitter), - flipper_format, - serial, - btn, - cnt, - name_sysmem, - preset); + encoder, flipper_format, serial, btn, cnt, name_sysmem, preset); // Fill out the SubGhzProtocolDecoderPrinceton (which includes SubGhzBlockGeneric data) in our transmitter based on parsing flipper_format. // initance->encoder.upload[] gets filled out with duration and level information (You can think of this as the RAW data). @@ -92,8 +89,10 @@ static void send_keeloq( // Start transmitting (keeps the DMA buffer filled with the encoder.upload[] data) if(subghz_devices_start_async_tx(device, subghz_transmitter_yield, transmitter)) { - // Wait for the transmission to complete. - while(!(subghz_devices_is_async_complete_tx(device))) { + int max_counter = 10; + + // Wait for the transmission to complete, or counter to expire (1 second). + while(max_counter-- && !(subghz_devices_is_async_complete_tx(device))) { furi_delay_ms(100); }