Skip to content

Commit

Permalink
Add support for GM ABO1502T Car Remote
Browse files Browse the repository at this point in the history
  • Loading branch information
eshaz committed Dec 29, 2023
1 parent f833743 commit 2693803
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
[260] Microchip HCS361 KeeLoq Hopping Encoder based remotes (315.1M No Sync, 833 bit/s)
[261] Microchip HCS361 KeeLoq Hopping Encoder based remotes (315.1M No Sync, 1667 bit/s)
[262] 6SC2 Car Remote (-f 315.1M -s 1024k)
[263] GM ABO1502T Car Remote (-f 315.1M)
* Disabled by default, use -R n or a conf file to enable
Expand Down
1 change: 1 addition & 0 deletions conf/rtl_433.example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ convert si
protocol 260 # Microchip HCS361 KeeLoq Hopping Encoder based remotes (315.1M No Sync, 833 bit/s)
protocol 261 # Microchip HCS361 KeeLoq Hopping Encoder based remotes (315.1M No Sync, 1667 bit/s)
protocol 262 # 6SC2 Car Remote (-f 315.1M -s 1024k)
protocol 263 # GM ABO1502T Car Remote (-f 315.1M)

## Flex devices (command line option "-X")

Expand Down
3 changes: 2 additions & 1 deletion include/rtl_433_devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@
DECL(hcs361_txwak_0_bsel_1) \
DECL(hcs361_txwak_1_bsel_0) \
DECL(hcs361_txwak_1_bsel_1) \
DECL(six_sc_two_car_remote)
DECL(six_sc_two_car_remote) \
DECL(gm_car_remote)

/* Add new decoders here. */

Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ add_library(r_433 STATIC
devices/generic_remote.c
devices/generic_temperature_sensor.c
devices/geo_minim.c
devices/gm_car_remote.c
devices/govee.c
devices/gt_tmbbq05.c
devices/gt_wt_02.c
Expand Down
134 changes: 134 additions & 0 deletions src/devices/gm_car_remote.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/** @file
GM - Car Remote.
Copyright (C) 2023 Ethan Halsall
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
/** @fn int gm_car_remote_decode(r_device *decoder, bitbuffer_t *bitbuffer)
General Motors - Car Remote (315 MHz)
Manufacturer:
- General Motors
Supported Models:
- ABO1502T
Data structure:
The transmitter uses a rolling code message with an unencrypted sequence number.
Button operation:
This transmitter has 2 to 4 buttons which can be pressed once to transmit a single message
Data layout:
PP xxxx cccc IIIIIIII SSSSSS EEEEEE CC
- P: 8 bit unknown, possibly part of the ID
- c: 4 bit checksum of button code
- b: 4 bit button code
- I: 32 bit ID
- S: 24 bit sequence
- E: 24 bit encrypted
- C: 8 bit checksum of entire payload
Format string:
UNKNOWN: bbbbbbbb BUTTON_CHECKSUM: bbbb BUTTON: bbbb ID: hhhhhhhh SEQUENCE: hhhhhh ENCRYPTED: hhhhhh CHECKSUM: hh
*/

#include "decoder.h"

static int gm_car_remote_decode(r_device *decoder, bitbuffer_t *bitbuffer)
{
if (bitbuffer->bits_per_row[0] < 113 || bitbuffer->num_rows > 1) {
return DECODE_ABORT_LENGTH;
}

// a long wake up payload is sent that may be truncated, so start from the end of the payload.
int offset = bitbuffer->bits_per_row[0] - 113;

uint8_t bytes[14];
bitbuffer_extract_bytes(bitbuffer, 0, offset, bytes, 112);

// check one byte from the wake up signal
if (bytes[0] != 0xff) {
return DECODE_FAIL_SANITY;
}

// validate mic
int button_checksum = add_nibbles(bytes + 2, 1);
if (button_checksum == 0 || (button_checksum & 0xf) != 0) {
return DECODE_FAIL_MIC;
}

int full_checksum = add_bytes(bytes + 1, 13);
if (full_checksum == 0 || (full_checksum & 0xff) != 0) {
return DECODE_FAIL_MIC;
}

// parse payload
int button = bytes[2] & 0x7;
uint32_t id = (bytes[3] << 24) | (bytes[4] << 16) | (bytes[5] << 8) | bytes[6];
int sequence = (bytes[7] << 16) | (bytes[8] << 8) | bytes[9];
uint32_t encrypted = (bytes[10] << 16) | (bytes[11] << 8) | bytes[12];

char id_str[11];
snprintf(id_str, sizeof(id_str), "%02X%08X", bytes[1], id);

char encrypted_str[7];
snprintf(encrypted_str, sizeof(encrypted_str), "%06X", encrypted);

char const *button_str;

/* clang-format off */
switch (button) {
case 0x1: button_str = "Unlock"; break;
case 0x2: button_str = "Lock"; break;
case 0x3: button_str = "Trunk"; break;
case 0x4: button_str = "Panic"; break;
default: button_str = "?"; break;
}
/* clang-format on */

/* clang-format off */
data_t *data = data_make(
"model", "model", DATA_STRING, "GM-ABO1502T",
"id", "ID", DATA_STRING, id_str,

Check failure on line 102 in src/devices/gm_car_remote.c

View workflow job for this annotation

GitHub Actions / Check code style

TRAILING whitespace error
"encrypted", "", DATA_STRING, encrypted_str,
"button_code", "Button Code", DATA_INT, button,
"button_str", "Button", DATA_STRING, button_str,
"sequence", "Sequence", DATA_INT, sequence,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
NULL);
/* clang-format on */

decoder_output_data(decoder, data);
return 1;
}

static char const *const output_fields[] = {
"model",
"id",
"encrypted",
"button_code",
"button_str",
"sequence",
"mic",
NULL,
};

r_device const gm_car_remote = {
.name = "GM ABO1502T Car Remote (-f 315.1M)",
.modulation = OOK_PULSE_PPM,
.short_width = 300,
.long_width = 500,
.reset_limit = 20000,
.decode_fn = &gm_car_remote_decode,
.fields = output_fields,
};

0 comments on commit 2693803

Please sign in to comment.