RE firmware

This commit is contained in:
TJ Horner
2023-01-31 21:25:10 -08:00
parent 920013eab1
commit 67e1cf6881
4 changed files with 67 additions and 1 deletions

5
reversing-firmware/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
# Gitignore settings for ESPHome
# This is an example and may include too much for your use-case.
# You can modify this file to suit your needs.
/.esphome/
/secrets.yaml

View File

@@ -0,0 +1,11 @@
# Reverse Engineering Firmware
This is a special firmware designed to aid in the reverse engineering of new desk control box protocols. You can find the complete reverse engineering guide [here](https://github.com/tjhorner/upsy-desky/wiki/Reverse-Engineering-Guide).
You can flash this firmware on your stock Upsy Desky; no additional hardware is required. It uses ESPHome's [UART debugging feature](https://esphome.io/components/uart.html#debugging) to log all communication between the keypad and control box. You can use this data to reverse engineer the protocol based on the RE guide linked above.
## Customization
Aside from the normal UART parameters like baud rate, it may be helpful to adjust the parameters in the UART debugging component to make the data more readable and easier to RE. Particularly useful is the `after` parameter, which allows you to log a string of bytes after some specified number of bytes, timeout, or delimiter. You can see the specific configuration options in the [ESPHome documentation](https://esphome.io/components/uart.html#debugging).
You may also wish to change the GPIO port to match the RX and TX pins on your control box if the defaults don't match yours. See the [GPIO Pinout](https://github.com/tjhorner/upsy-desky/wiki/GPIO-Pinout) mapping to see which RJ45 pins correspond to which GPIO pins.

View File

@@ -0,0 +1,50 @@
substitutions:
name: "upsy-desky"
esphome:
name: "${name}"
name_add_mac_suffix: true
esp32:
board: esp32dev
logger:
level: DEBUG
# UART logging is from the perspective of the handset, i.e.:
# - TX is the data sent from the handset to the control box
# - RX is the data sent from the control box to the handset
uart:
- # Direction: Handset -> Control Box
id: handset_tx
baud_rate: 9600
rx_pin: 17
debug: &uart_debug
direction: RX
dummy_receiver: true
after:
timeout: 50ms
sequence:
- lambda: UARTDebug::log_hex(uart::UART_DIRECTION_TX, bytes, ':');
- # Direction: Control Box -> Handset
id: handset_rx
baud_rate: 9600
rx_pin: 16
debug:
<<: *uart_debug
sequence:
- lambda: UARTDebug::log_hex(uart::UART_DIRECTION_RX, bytes, ':');
wifi:
ap:
password: "hunter2hunter2"
captive_portal:
improv_serial:
web_server:
port: 80
ota:
password: ""

View File

@@ -1,6 +1,6 @@
# Test Firmware
This firmware is used to test assembled boards before shipping. In the future I'd like this process to be more automated but this is what I have for now.
This firmware is used to test assembled boards before shipping. In the future I'd like this process to be more automated and comprehensive but this is what I have for now.
## Usage