A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol
C arduinobluetoothcan-busdebuggingeepromesp32flipperzerogpiohardware-hackingi2cjtagopenocdprotocolspwmradiorfidspisubghzuartwifi
improve infrared send/receive
Geo23c08826cd21
diff --git a/src/Data/DeviceBgoneCommands.h b/src/Data/DeviceBgoneCommands.hindex 29b8fe13..99c1b77e 100644--- a/src/Data/DeviceBgoneCommands.h+++ b/src/Data/DeviceBgoneCommands.h@@ -9,8 +9,10 @@ inline const std::vector<InfraredCommand> deviceBgoneCommands = {{NECX2, 7, -1, 2},{SAMSUNG32, 7, 7, 2},{SAMSUNG20, 7, -1, 2},+ {SAMSUNG20, 7, 7, 2},{SAMSUNG36, 7, 7, 2},{NECX2, 4, -1, 8},+ {_NEC, 4, -1, 8},{_RC5, 0, 0, 12},{SONY20, 1, 0, 21},{SONY20, 2, 0, 21},@@ -99,7 +101,14 @@ inline const std::vector<InfraredCommand> deviceBgoneCommands = {{ _NEC, 0, -1, 57 },{ _NEC, 0, -1, 135 },{ F12, 0, -1, 128 },-+ { LEGO, 0, -1, 0 }, // LEGO channel 0 OFF+ { LEGO, 0, -1, 1 }, // LEGO channel 0 ON+ { LEGO, 1, -1, 0 }, // LEGO channel 1 OFF+ { LEGO, 1, -1, 1 }, // LEGO channel 1 ON+ { LEGO, 2, -1, 0 }, // LEGO channel 2 OFF+ { LEGO, 2, -1, 1 }, // LEGO channel 2 ON+ { LEGO, 3, -1, 0 }, // LEGO channel 3 OFF+ { LEGO, 3, -1, 1 }, // LEGO channel 3 ON// NEC‑based universal power codes{ _NEC2, 0, -1, 16 }, // NEC generic power@@ -112,6 +121,14 @@ inline const std::vector<InfraredCommand> deviceBgoneCommands = {{ SAMSUNG32, 0, -1, 44 }, // Samsung 32bit power{ SAMSUNG36, 0, -1, 44 }, // Samsung 36bit variant+ // Repeat this one in case start was missed+ {NECX2, 7, 7, 2},+ {NECX2, 7, -1, 2},+ {SAMSUNG32, 7, 7, 2},+ {SAMSUNG20, 7, -1, 2},+ {SAMSUNG36, 7, 7, 2},+ {NECX2, 4, -1, 8},+// Sony{ SONY20, 1, 0, 21 }, // Sony20 standard power{ SONY12, 1, 0, 21 }, // Sony12 standard powerdiff --git a/src/Enums/InfraredProtocolEnum.h b/src/Enums/InfraredProtocolEnum.hindex 93be2a9e..83951c4e 100644--- a/src/Enums/InfraredProtocolEnum.h+++ b/src/Enums/InfraredProtocolEnum.h@@ -116,7 +116,8 @@ typedef enum InfraredProtocolEnum {NEC42ext = 110,RC5X = 111,SAMSUNG32 = 112,- RAW = 113,+ LEGO = 113,+ RAW = 114,} InfraredProtocolEnum;class InfraredProtocolMapper {diff --git a/src/Services/InfraredService.cpp b/src/Services/InfraredService.cppindex 941f6ee7..be8d680f 100644--- a/src/Services/InfraredService.cpp+++ b/src/Services/InfraredService.cpp@@ -19,32 +19,40 @@ void InfraredService::sendInfraredCommand(InfraredCommand command) {uint16_t address;uint16_t vendorCode;std::string protocolString = InfraredProtocolMapper::toString(command.getProtocol());+ uint8_t subdevice = command.getSubdevice() == -1 ? 0 : command.getSubdevice();+ uint8_t device = command.getDevice();++ // Combine device and subdevice into a 16-bit integer+ uint16_t address = (static_cast<uint16_t>(subdevice) << 8) | device;switch (command.getProtocol()) {- // Makehex seems to not handle Panasonic correctly, we use IRemote instead+ case InfraredProtocolEnum::_SAMSUNG:+ case InfraredProtocolEnum::SAMSUNG20: {+ IrSender.sendSamsung(address, command.getFunction(), 0);+ break;+ }+case InfraredProtocolEnum::_PANASONIC:case InfraredProtocolEnum::PANASONIC2: {- subdevice = command.getSubdevice() == -1 ? 0 : command.getSubdevice(); // -1 to 0 if needed-- // Combine device and subdevice into a 16-bit integer- uint16_t address = (static_cast<uint16_t>(command.getSubdevice()) << 8) | command.getDevice();-// Panasonic can be used by many manufacturers in the IRDB format, we check for vendor namevendorCode = getKaseikyoVendorIdCode(protocolString);IrSender.sendKaseikyo(address, command.getFunction(), 0, vendorCode);break;}+// Same for Sony20case InfraredProtocolEnum::SONY20: {- subdevice = command.getSubdevice() == -1 ? 0 : command.getSubdevice();-- // Combine device and subdevice into a 16-bit integer- uint16_t address = (static_cast<uint16_t>(command.getSubdevice()) << 8) | command.getDevice();-IrSender.sendSony(address, command.getFunction(), 0, SIRCS_20_PROTOCOL);break;}++ // LEGO+ case InfraredProtocolEnum::LEGO: {+ IrSender.sendLegoPowerFunctions(address, command.getFunction(), 0);+ break;+ }+// Handle by MakeHexdefault: {int frequency = 38; // Default frequency, passed by reference to encodeRemoteCommand@@ -80,9 +88,11 @@ InfraredCommand InfraredService::receiveInfraredCommand() {// Mapping protocolsswitch (data.protocol) {case NEC:+ command.setProtocol(_NEC);+ break;case NEC2:case ONKYO:- command.setProtocol(_NEC);+ command.setProtocol(_NEC2);break;case DENON:@@ -105,26 +115,41 @@ InfraredCommand InfraredService::receiveInfraredCommand() {command.setProtocol(_RC5);break;+ case BOSEWAVE:+ case BANG_OLUFSEN:+ command.setProtocol(BOSE);+case RC6:- case RC6_6_20:command.setProtocol(_RC6);break;-case LG:case LG2:case SAMSUNG:+ command.setProtocol(SAMSUNG20);+ break;+case SAMSUNGLG:case SAMSUNG48:command.setProtocol(_SAMSUNG);break;case PANASONIC:- case KASEIKYO:+ command.setProtocol(_PANASONIC);+ break;+case KASEIKYO_DENON:+ command.setProtocol(DENON_K);+ break;++ case KASEIKYO:case KASEIKYO_SHARP:case KASEIKYO_JVC:case KASEIKYO_MITSUBISHI:- command.setProtocol(_PANASONIC);+ command.setProtocol(_KASEIKYO);+ break;++ case LEGO_PF:+ command.setProtocol(LEGO);break;default: