diff --git a/lib/subghz/protocols/keeloq.c b/lib/subghz/protocols/keeloq.c index 10cd5fecc..9d97107d2 100644 --- a/lib/subghz/protocols/keeloq.c +++ b/lib/subghz/protocols/keeloq.c @@ -154,6 +154,7 @@ static bool subghz_protocol_keeloq_gen_data(SubGhzProtocolEncoderKeeloq* instanc code_found_reverse = subghz_protocol_blocks_reverse_key( instance->generic.data, instance->generic.data_count_bit); hop = code_found_reverse & 0x00000000ffffffff; + FURI_LOG_I(TAG, "hop = %X", hop); break; } break; @@ -163,11 +164,8 @@ static bool subghz_protocol_keeloq_gen_data(SubGhzProtocolEncoderKeeloq* instanc uint64_t yek = (uint64_t)fix << 32 | hop; instance->generic.data = subghz_protocol_blocks_reverse_key(yek, instance->generic.data_count_bit); - return true; - } else { - instance->manufacture_name = "Unknown"; - return false; } + return true; } bool subghz_protocol_keeloq_create_data( diff --git a/lib/subghz/protocols/nice_flor_s.c b/lib/subghz/protocols/nice_flor_s.c index 9d880f852..c28ad3df2 100644 --- a/lib/subghz/protocols/nice_flor_s.c +++ b/lib/subghz/protocols/nice_flor_s.c @@ -128,10 +128,10 @@ static bool } instance->generic.cnt++; - uint64_t decrypt = btn << 4 | 0x0 << 28 | instance->generic.serial << 16 | instance->generic.cnt; + uint64_t decrypt = (uint64_t)instance->generic.serial << 16 | instance->generic.cnt; FURI_LOG_I(TAG, "decrypt = %X", decrypt); - uint64_t temp_parcel = subghz_protocol_nice_flor_s_encrypt(decrypt, file_name); - FURI_LOG_I(TAG, "temp_parcel = %X", temp_parcel); + uint64_t enc_part = (uint64_t)subghz_protocol_nice_flor_s_encrypt(decrypt, file_name); + FURI_LOG_I(TAG, "enc_part = %X", enc_part); for (int i = 0; i < 16; i++) { @@ -150,16 +150,25 @@ static bool 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0xF, 0xE, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8 } }; + if (btn == 0x1) { - instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[0][i]) << 44 | (temp_parcel & 0xFFFFFFFFFFF); - } else if (btn == 0x2) { - instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[1][i]) << 44 | (temp_parcel & 0xFFFFFFFFFFF); - } else if (btn == 0x4) { - instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[2][i]) << 44 | (temp_parcel & 0xFFFFFFFFFFF); - } else if (btn == 0x8) { - instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[3][i]) << 44 | (temp_parcel & 0xFFFFFFFFFFF); - } + //Button 1 + instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[0][i]) << 44 | (enc_part); + } + if (btn == 0x2) { + //Button 2 + instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[1][i]) << 44 | (enc_part); + } + if (btn == 0x4) { + //Button 3 + instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[2][i]) << 44 | (enc_part); + } + if (btn == 0x8) { + //Button 4 + instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[3][i]) << 44 | (enc_part); + } FURI_LOG_I(TAG, "key = %X", instance->generic.data); + //Send header for(uint8_t i = 35; i > 0; i--) { instance->encoder.upload[index++] =