@@ -1567,7 +1567,8 @@ void subghz_protocol_decoder_keeloq_get_string(void* context, FuriString* output
15671567 SubGhzProtocolDecoderKeeloq * instance = context ;
15681568
15691569 uint32_t hopdecrypt = 0 ;
1570-
1570+ // Try to get decrypt for display if mf is known, if not it will be 0 and display will be without decrypt part since it might come already decrypted like in HCS101 or AN-Motors
1571+ // Or we might have Unknown MF
15711572 hopdecrypt = subghz_protocol_keeloq_check_remote_controller (
15721573 & instance -> generic , instance -> keystore , & instance -> manufacture_name );
15731574
@@ -1579,16 +1580,56 @@ void subghz_protocol_decoder_keeloq_get_string(void* context, FuriString* output
15791580 uint32_t code_found_reverse_hi = code_found_reverse >> 32 ;
15801581 uint32_t code_found_reverse_lo = code_found_reverse & 0x00000000ffffffff ;
15811582
1582- if (strcmp (instance -> manufacture_name , "BFT" ) == 0 ) {
1583- // push protocol data to global variable
1583+ // Allow button edit
1584+ subghz_block_generic_global .btn_is_available = true;
1585+ subghz_block_generic_global .current_btn = instance -> generic .btn ;
1586+ subghz_block_generic_global .btn_length_bit = 4 ;
1587+
1588+ if (strcmp (instance -> manufacture_name , "AN-Motors" ) == 0 ) {
1589+ // No counter only pseudo counter
1590+ subghz_block_generic_global .cnt_is_available = false;
1591+ furi_string_cat_printf (
1592+ output ,
1593+ "%s %dbit\r\n"
1594+ "Key:%08lX%08lX\r\n"
1595+ "Fix:0x%08lX PsCn:%04lX\r\n"
1596+ "Hop:0x%08lX Btn:%01X\r\n"
1597+ "MF:%s" ,
1598+ instance -> generic .protocol_name ,
1599+ instance -> generic .data_count_bit ,
1600+ code_found_hi ,
1601+ code_found_lo ,
1602+ code_found_reverse_hi ,
1603+ instance -> generic .cnt ,
1604+ code_found_reverse_lo ,
1605+ instance -> generic .btn ,
1606+ instance -> manufacture_name );
1607+ } else if (strcmp (instance -> manufacture_name , "HCS101" ) == 0 ) {
1608+ // Counter is present but not encrypted
1609+ subghz_block_generic_global .cnt_is_available = true;
1610+ subghz_block_generic_global .cnt_length_bit = 16 ;
1611+ subghz_block_generic_global .current_cnt = instance -> generic .cnt ;
1612+ furi_string_cat_printf (
1613+ output ,
1614+ "%s %dbit\r\n"
1615+ "Key:%08lX%08lX\r\n"
1616+ "Fix:0x%08lX Cnt:%04lX\r\n"
1617+ "Hop:0x%08lX Btn:%01X\r\n"
1618+ "MF:%s" ,
1619+ instance -> generic .protocol_name ,
1620+ instance -> generic .data_count_bit ,
1621+ code_found_hi ,
1622+ code_found_lo ,
1623+ code_found_reverse_hi ,
1624+ instance -> generic .cnt ,
1625+ code_found_reverse_lo ,
1626+ instance -> generic .btn ,
1627+ instance -> manufacture_name );
1628+ } else if (strcmp (instance -> manufacture_name , "BFT" ) == 0 ) {
1629+ // Allow counter edit
15841630 subghz_block_generic_global .cnt_is_available = true;
15851631 subghz_block_generic_global .cnt_length_bit = 16 ;
15861632 subghz_block_generic_global .current_cnt = instance -> generic .cnt ;
1587-
1588- subghz_block_generic_global .btn_is_available = true;
1589- subghz_block_generic_global .current_btn = instance -> generic .btn ;
1590- subghz_block_generic_global .btn_length_bit = 4 ;
1591- //
15921633
15931634 ProgMode prog_mode = subghz_custom_btn_get_prog_mode ();
15941635 if (prog_mode == PROG_MODE_KEELOQ_BFT ) {
@@ -1629,10 +1670,9 @@ void subghz_protocol_decoder_keeloq_get_string(void* context, FuriString* output
16291670 instance -> generic .seed );
16301671 }
16311672 } else if (strcmp (instance -> manufacture_name , "Unknown" ) == 0 ) {
1632- subghz_block_generic_global .btn_is_available = true;
1633- subghz_block_generic_global .current_btn = instance -> generic .btn ;
1634- subghz_block_generic_global .btn_length_bit = 4 ;
1673+ // No counter info with unknown MF
16351674 instance -> generic .cnt = 0x0 ;
1675+ subghz_block_generic_global .cnt_is_available = false;
16361676 furi_string_cat_printf (
16371677 output ,
16381678 "%s %dbit\r\n"
@@ -1649,12 +1689,10 @@ void subghz_protocol_decoder_keeloq_get_string(void* context, FuriString* output
16491689 instance -> generic .btn ,
16501690 instance -> manufacture_name );
16511691 } else {
1692+ // All other known MF with counter info, allow counter edit
16521693 subghz_block_generic_global .cnt_is_available = true;
16531694 subghz_block_generic_global .cnt_length_bit = 16 ;
16541695 subghz_block_generic_global .current_cnt = instance -> generic .cnt ;
1655- subghz_block_generic_global .btn_is_available = true;
1656- subghz_block_generic_global .current_btn = instance -> generic .btn ;
1657- subghz_block_generic_global .btn_length_bit = 4 ;
16581696 furi_string_cat_printf (
16591697 output ,
16601698 "%s %dbit\r\n"
0 commit comments