mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00:00
more chance to generate working remote at gangqi
This commit is contained in:
parent
6911ba12ad
commit
5da447a2b0
2 changed files with 15 additions and 4 deletions
|
@ -387,14 +387,23 @@ void subghz_txrx_gen_serial_gangqi(uint64_t* result_key) {
|
||||||
uint64_t randkey;
|
uint64_t randkey;
|
||||||
uint64_t only_required_bytes;
|
uint64_t only_required_bytes;
|
||||||
uint16_t sum_of_3bytes;
|
uint16_t sum_of_3bytes;
|
||||||
|
uint8_t xorbytes;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
randkey = (uint64_t)rand();
|
randkey = (uint64_t)rand();
|
||||||
only_required_bytes = (randkey & 0xFFFFF0000);
|
only_required_bytes = (randkey & 0x0FFFF0000) | 0x200000000;
|
||||||
sum_of_3bytes = ((only_required_bytes >> 32) & 0xFF) +
|
sum_of_3bytes = ((only_required_bytes >> 32) & 0xFF) +
|
||||||
((only_required_bytes >> 24) & 0xFF) +
|
((only_required_bytes >> 24) & 0xFF) +
|
||||||
((only_required_bytes >> 16) & 0xFF);
|
((only_required_bytes >> 16) & 0xFF);
|
||||||
} while(!((!(sum_of_3bytes & 0x3)) && ((0xb2 < sum_of_3bytes) && (sum_of_3bytes < 0x1ae))));
|
xorbytes = ((only_required_bytes >> 32) & 0xFF) ^ ((only_required_bytes >> 24) & 0xFF) ^
|
||||||
|
((only_required_bytes >> 16) & 0xFF);
|
||||||
|
} while(
|
||||||
|
!((((!(sum_of_3bytes & 0x3)) && ((0xB < sum_of_3bytes) && (sum_of_3bytes < 0x141))) &&
|
||||||
|
((((only_required_bytes >> 32) & 0xFF) == 0x2) ||
|
||||||
|
(((only_required_bytes >> 32) & 0xFF) == 0x3))) &&
|
||||||
|
((((xorbytes == 0xBA) || (xorbytes == 0xE2)) ||
|
||||||
|
((xorbytes == 0x3A) || (xorbytes == 0xF2))) ||
|
||||||
|
(xorbytes == 0xB2))));
|
||||||
|
|
||||||
// Serial 01 button 01
|
// Serial 01 button 01
|
||||||
uint64_t new_key = only_required_bytes | (0b01 << 14) | (0xD << 10) | (0b01 << 8);
|
uint64_t new_key = only_required_bytes | (0b01 << 14) | (0xD << 10) | (0b01 << 8);
|
||||||
|
|
|
@ -494,8 +494,10 @@ void subghz_protocol_decoder_gangqi_get_string(void* context, FuriString* output
|
||||||
(instance->generic.serial & 0xFF);
|
(instance->generic.serial & 0xFF);
|
||||||
// Returns true if serial is valid
|
// Returns true if serial is valid
|
||||||
bool serial_is_valid =
|
bool serial_is_valid =
|
||||||
((!(sum_3bytes_serial & 0x3)) &&
|
(((!(sum_3bytes_serial & 0x3)) &&
|
||||||
((0xb2 < sum_3bytes_serial) && (sum_3bytes_serial < 0x1ae)));
|
((0xB < sum_3bytes_serial) && (sum_3bytes_serial < 0x141))) &&
|
||||||
|
((((instance->generic.serial >> 16) & 0xFF) == 0x2) ||
|
||||||
|
(((instance->generic.serial >> 16) & 0xFF) == 0x3)));
|
||||||
|
|
||||||
furi_string_cat_printf(
|
furi_string_cat_printf(
|
||||||
output,
|
output,
|
||||||
|
|
Loading…
Reference in a new issue