- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在研究由 IR Remote 控制的 Panasonic AC Unit。 Remote 发送 12 个字节
。
前 5 个字节
始终相同。下面的6个字节
分别对应空调温度、风扇、功能等我自己摸索出来的选项。
最后一个 byte
是一个校验和,它是从前 11 个字节
(或从 byte 6
到 11
)
因为我在运行时重新创建了 IR 代码,所以我需要能够为这些数据包计算校验和。我尝试了许多标准校验和算法,但没有一个给出有意义的结果。
你能帮我找出这个设备使用的校验和函数吗?
这是一个数据包的列表,由11字节
的 header +数据和1字节
的校验和组成,我能够从设备中捕获:
40 00 14 81 25 00 A0 65 00 00 00 26
40 00 14 81 25 00 A0 68 00 00 07 30
40 00 14 81 25 04 28 65 00 00 00 2A
40 00 14 81 25 04 28 68 00 00 00 2D
40 00 14 81 25 04 28 68 00 00 02 2F
40 00 14 81 25 04 28 68 00 00 03 30
40 00 14 81 25 04 28 68 00 00 04 31
40 00 14 81 25 04 28 68 00 00 05 32
40 00 14 81 25 04 28 68 00 00 07 34
40 00 14 81 25 04 28 69 00 00 01 2F
40 00 14 81 25 04 A0 68 00 00 07 34
40 00 14 81 25 08 9A 68 00 00 07 41
40 00 14 81 25 08 9C 68 00 00 07 43
40 00 14 81 25 08 9E 68 00 00 07 45
40 00 14 81 25 08 A0 68 00 00 00 31
40 00 14 81 25 08 A0 68 00 00 01 32
40 00 14 81 25 08 A0 68 00 00 02 33
40 00 14 81 25 08 A0 68 00 00 03 34
40 00 14 81 25 08 A0 68 00 00 07 38
40 00 14 81 25 08 A2 68 00 00 07 3A
40 00 14 81 25 08 A4 68 00 00 07 3C
40 00 14 81 25 08 A6 68 00 00 07 3E
40 00 14 81 25 08 A8 68 00 00 07 40
40 00 14 81 25 08 AA 68 00 00 07 42
40 00 14 81 25 08 AC 68 00 00 07 44
40 00 14 81 25 08 AE 68 00 00 07 46
40 00 14 81 25 09 A0 68 00 00 07 39
40 00 14 81 25 0A A0 68 00 00 07 3A
40 00 14 81 25 0C A0 68 00 00 07 3C
40 00 14 81 25 40 18 65 00 00 00 29
40 00 14 81 25 40 1A 65 00 00 00 2B
40 00 14 81 25 40 1C 65 00 00 00 2D
40 00 14 81 25 40 1E 65 00 00 00 2F
40 00 14 81 25 40 20 65 00 00 00 22
40 00 14 81 25 40 22 65 00 00 00 24
40 00 14 81 25 40 24 65 00 00 00 26
40 00 14 81 25 40 26 65 00 00 00 28
40 00 14 81 25 40 28 65 00 00 00 2A
40 00 14 81 25 40 2A 65 00 00 00 2C
40 00 14 81 25 40 2C 65 00 00 00 2E
40 00 14 81 25 40 2E 65 00 00 00 30
40 00 14 81 25 40 30 65 00 00 00 23
40 00 14 81 25 40 32 65 00 00 00 25
40 00 14 81 25 40 34 65 00 00 00 27
40 00 14 81 25 40 34 68 00 00 04 2E
40 00 14 81 25 80 1C 68 00 00 00 34
40 00 14 81 25 80 20 65 00 00 00 26
40 00 14 81 25 C0 20 65 00 00 00 2A
40 00 14 81 25 C0 28 68 00 00 02 37
最佳答案
我找到了一个候选校验和函数,它匹配您的所有数据,但我认为需要进一步调整,因为我怀疑魔数(Magic Number) 我使用的取决于 其他 我没有正确考虑的东西。
这是我能够逆向工程的函数:
uint8_t get_checksum(const uint8_t data[], const size_t size)
{
assert(data);
uint8_t checksum = 0;
for (size_t i = 0; i < size; ++i)
{
checksum += (data[i] >> 4) + (data[i] & 0x0f);
}
checksum -= 8; /* magic number */
return checksum;
};
另一个版本:
uint8_t get_checksum(const uint8_t data[], const size_t size)
{
assert(data);
uint8_t checksum = 0xF8; /* magic number */
for (size_t i = 0; i < size; ++i)
{
checksum += (data[i] >> 4) + (data[i] & 0x0f);
}
return checksum;
};
示例:
#include<stdio.h>
#include<stdint.h>
#include<assert.h>
uint8_t get_checksum(const uint8_t data[], const size_t size)
{
assert(data);
uint8_t checksum = 0xF8; /* magic number */
for (size_t i = 0; i < size; ++i)
{
checksum += (data[i] >> 4) + (data[i] & 0x0f);
}
return checksum;
};
int main ()
{
const size_t xlen = 49;
const size_t ylen = 12;
uint8_t v[49][12] = {
{0x40,0x00,0x14,0x81,0x25,0x00,0xA0,0x65,0x00,0x00,0x00,0x26},
{0x40,0x00,0x14,0x81,0x25,0x00,0xA0,0x68,0x00,0x00,0x07,0x30},
{0x40,0x00,0x14,0x81,0x25,0x04,0x28,0x65,0x00,0x00,0x00,0x2A},
{0x40,0x00,0x14,0x81,0x25,0x04,0x28,0x68,0x00,0x00,0x00,0x2D},
{0x40,0x00,0x14,0x81,0x25,0x04,0x28,0x68,0x00,0x00,0x02,0x2F},
{0x40,0x00,0x14,0x81,0x25,0x04,0x28,0x68,0x00,0x00,0x03,0x30},
{0x40,0x00,0x14,0x81,0x25,0x04,0x28,0x68,0x00,0x00,0x04,0x31},
{0x40,0x00,0x14,0x81,0x25,0x04,0x28,0x68,0x00,0x00,0x05,0x32},
{0x40,0x00,0x14,0x81,0x25,0x04,0x28,0x68,0x00,0x00,0x07,0x34},
{0x40,0x00,0x14,0x81,0x25,0x04,0x28,0x69,0x00,0x00,0x01,0x2F},
{0x40,0x00,0x14,0x81,0x25,0x04,0xA0,0x68,0x00,0x00,0x07,0x34},
{0x40,0x00,0x14,0x81,0x25,0x08,0x9A,0x68,0x00,0x00,0x07,0x41},
{0x40,0x00,0x14,0x81,0x25,0x08,0x9C,0x68,0x00,0x00,0x07,0x43},
{0x40,0x00,0x14,0x81,0x25,0x08,0x9E,0x68,0x00,0x00,0x07,0x45},
{0x40,0x00,0x14,0x81,0x25,0x08,0xA0,0x68,0x00,0x00,0x00,0x31},
{0x40,0x00,0x14,0x81,0x25,0x08,0xA0,0x68,0x00,0x00,0x01,0x32},
{0x40,0x00,0x14,0x81,0x25,0x08,0xA0,0x68,0x00,0x00,0x02,0x33},
{0x40,0x00,0x14,0x81,0x25,0x08,0xA0,0x68,0x00,0x00,0x03,0x34},
{0x40,0x00,0x14,0x81,0x25,0x08,0xA0,0x68,0x00,0x00,0x07,0x38},
{0x40,0x00,0x14,0x81,0x25,0x08,0xA2,0x68,0x00,0x00,0x07,0x3A},
{0x40,0x00,0x14,0x81,0x25,0x08,0xA4,0x68,0x00,0x00,0x07,0x3C},
{0x40,0x00,0x14,0x81,0x25,0x08,0xA6,0x68,0x00,0x00,0x07,0x3E},
{0x40,0x00,0x14,0x81,0x25,0x08,0xA8,0x68,0x00,0x00,0x07,0x40},
{0x40,0x00,0x14,0x81,0x25,0x08,0xAA,0x68,0x00,0x00,0x07,0x42},
{0x40,0x00,0x14,0x81,0x25,0x08,0xAC,0x68,0x00,0x00,0x07,0x44},
{0x40,0x00,0x14,0x81,0x25,0x08,0xAE,0x68,0x00,0x00,0x07,0x46},
{0x40,0x00,0x14,0x81,0x25,0x09,0xA0,0x68,0x00,0x00,0x07,0x39},
{0x40,0x00,0x14,0x81,0x25,0x0A,0xA0,0x68,0x00,0x00,0x07,0x3A},
{0x40,0x00,0x14,0x81,0x25,0x0C,0xA0,0x68,0x00,0x00,0x07,0x3C},
{0x40,0x00,0x14,0x81,0x25,0x40,0x18,0x65,0x00,0x00,0x00,0x29},
{0x40,0x00,0x14,0x81,0x25,0x40,0x1A,0x65,0x00,0x00,0x00,0x2B},
{0x40,0x00,0x14,0x81,0x25,0x40,0x1C,0x65,0x00,0x00,0x00,0x2D},
{0x40,0x00,0x14,0x81,0x25,0x40,0x1E,0x65,0x00,0x00,0x00,0x2F},
{0x40,0x00,0x14,0x81,0x25,0x40,0x20,0x65,0x00,0x00,0x00,0x22},
{0x40,0x00,0x14,0x81,0x25,0x40,0x22,0x65,0x00,0x00,0x00,0x24},
{0x40,0x00,0x14,0x81,0x25,0x40,0x24,0x65,0x00,0x00,0x00,0x26},
{0x40,0x00,0x14,0x81,0x25,0x40,0x26,0x65,0x00,0x00,0x00,0x28},
{0x40,0x00,0x14,0x81,0x25,0x40,0x28,0x65,0x00,0x00,0x00,0x2A},
{0x40,0x00,0x14,0x81,0x25,0x40,0x2A,0x65,0x00,0x00,0x00,0x2C},
{0x40,0x00,0x14,0x81,0x25,0x40,0x2C,0x65,0x00,0x00,0x00,0x2E},
{0x40,0x00,0x14,0x81,0x25,0x40,0x2E,0x65,0x00,0x00,0x00,0x30},
{0x40,0x00,0x14,0x81,0x25,0x40,0x30,0x65,0x00,0x00,0x00,0x23},
{0x40,0x00,0x14,0x81,0x25,0x40,0x32,0x65,0x00,0x00,0x00,0x25},
{0x40,0x00,0x14,0x81,0x25,0x40,0x34,0x65,0x00,0x00,0x00,0x27},
{0x40,0x00,0x14,0x81,0x25,0x40,0x34,0x68,0x00,0x00,0x04,0x2E},
{0x40,0x00,0x14,0x81,0x25,0x80,0x1C,0x68,0x00,0x00,0x00,0x34},
{0x40,0x00,0x14,0x81,0x25,0x80,0x20,0x65,0x00,0x00,0x00,0x26},
{0x40,0x00,0x14,0x81,0x25,0xC0,0x20,0x65,0x00,0x00,0x00,0x2A},
{0x40,0x00,0x14,0x81,0x25,0xC0,0x28,0x68,0x00,0x00,0x02,0x37}
};
// packet has 11 bytes, 1 byte is for the checksum
for (size_t i = 0; i < xlen; ++i)
{
uint8_t checksum = get_checksum(v[i], 11);
printf("result: %02x -- should be: %02x -- %s\n",
checksum, v[i][ylen - 1],
(checksum - v[i][ylen - 1] == 0 ? "OK" : "ERROR"));
}
}
输出:
result: 26 -- should be: 26 -- OK
result: 30 -- should be: 30 -- OK
result: 2a -- should be: 2a -- OK
result: 2d -- should be: 2d -- OK
result: 2f -- should be: 2f -- OK
result: 30 -- should be: 30 -- OK
result: 31 -- should be: 31 -- OK
result: 32 -- should be: 32 -- OK
result: 34 -- should be: 34 -- OK
result: 2f -- should be: 2f -- OK
result: 34 -- should be: 34 -- OK
result: 41 -- should be: 41 -- OK
result: 43 -- should be: 43 -- OK
result: 45 -- should be: 45 -- OK
result: 31 -- should be: 31 -- OK
result: 32 -- should be: 32 -- OK
result: 33 -- should be: 33 -- OK
result: 34 -- should be: 34 -- OK
result: 38 -- should be: 38 -- OK
result: 3a -- should be: 3a -- OK
result: 3c -- should be: 3c -- OK
result: 3e -- should be: 3e -- OK
result: 40 -- should be: 40 -- OK
result: 42 -- should be: 42 -- OK
result: 44 -- should be: 44 -- OK
result: 46 -- should be: 46 -- OK
result: 39 -- should be: 39 -- OK
result: 3a -- should be: 3a -- OK
result: 3c -- should be: 3c -- OK
result: 29 -- should be: 29 -- OK
result: 2b -- should be: 2b -- OK
result: 2d -- should be: 2d -- OK
result: 2f -- should be: 2f -- OK
result: 22 -- should be: 22 -- OK
result: 24 -- should be: 24 -- OK
result: 26 -- should be: 26 -- OK
result: 28 -- should be: 28 -- OK
result: 2a -- should be: 2a -- OK
result: 2c -- should be: 2c -- OK
result: 2e -- should be: 2e -- OK
result: 30 -- should be: 30 -- OK
result: 23 -- should be: 23 -- OK
result: 25 -- should be: 25 -- OK
result: 27 -- should be: 27 -- OK
result: 2e -- should be: 2e -- OK
result: 34 -- should be: 34 -- OK
result: 26 -- should be: 26 -- OK
result: 2a -- should be: 2a -- OK
result: 37 -- should be: 37 -- OK
关于arduino - 逆向工程 Panasonic IR 代码校验和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42092565/
我已经设置了自定义 SSIS IR,但是从 IR 节点上的当前工作目录或临时文件夹读取文件时遇到问题 https://learn.microsoft.com/en-us/sql/integration
我已经编写了一个修改中间表示 (IR) 代码的 LLVM pass。为了增加可移植性,我还希望它与 gcc 编译器一起工作。所以我想知道是否有任何工具可以将 gcc 的某些中间表示 (IR) 转换为
我已经下载了 Sony Android Add-on IR SDK ( http://developer.sonymobile.com/knowledge-base/sdks/sony-add-on-
我在手机中使用其他应用程序,使用它的 IR。但是当我尝试在任何项目中使用 IREmitter 时,它会触发该错误! mCIR = (ConsumerIrManager)getSystemService
我想找到一些 Clang/LLVM 的调试选项,其工作方式类似于 GCC -fdump-tree-all-all , -fdump-rtl-all ,和 -fdump-ipa-all-all . 基本
我使用 LLVM opt 来运行一个传递,例如,opt -load libMyPass.so my-pass foo.ll > foo1.ll。 foo.ll 是一个 IR 文件,我希望 foo1.l
我在 Raspian jessie(无像素)(所有更新和升级)上安装了当前的 lirc 包(0.9.0~pre1-1.2)并连接到(lirc 默认)GPIO 端口: 到 gpio 端口 17 - 通过
在学习 Antlr4 时,我使用 Golang 作为目标语言,所以我的玩具语言中的语句如下: $myVar = 10 $myVar + 5 将转换为一些生成结果“15”的 Golang 代码 但是,据
我正在尝试使用 SSIS 脚本任务连接到本地 REST Web 服务,并在 Azure 数据工厂的 SSIS-IR 上运行它,该 SSIS-IR 具有自托管 IR 的代理,最终连接到本地服务器。可行吗
我正在尝试关注 this链接以便为 c 代码生成 IR 表示。我使用的c代码如下 void main() { int c1 = 17; int c2 = 25; int c3 = c1 + c2
在为 lto 链接后,有没有办法获得 llvm IR?例如,我有以下行: $ clang -flto -O2 a.c main.c -fuse-ld=gold -v -save-temps 所以我想获
我正在通过这个学习 LLVM IR LangRef . 如本引用所述: LLVM programs are composed of Modules, each of which is a transl
如果这个问题听起来很愚蠢,我很抱歉。 为什么inverse document frequency使用日志?日志在 tf/idf 中有何帮助? 最佳答案 AFAIK,使用日志有助于使用几何分布对数字进行
我建立了一个LLVM定位前端,该前端会产生一些IR。随后并且完全可以预期,在某些情况下,IR输出是不正确的(例如,它看起来正确,但是执行时结果程序崩溃)。但是,我还没有找到很多有用的工具来解决这一问题
我想将C#编译为LLVM IR。因此,我认为将编译的CIL转换为LLVM IR是我可以尝试的一种方法。 我可以使用一些工具,例如vmkit和mono-llvm。 有人在使用此工具吗?或者如何将CIL转
如何创建图像以及如何使用十六进制颜色代码逐像素为其着色? 例如。我想创建一个 100x100 像素的图像,并且我想要 1x1 区域的颜色为“$002125”,2x2 区域的颜色为“$125487”..
我正在测试一个 main 函数,它只返回 void 并且在使用 lli 运行位码时出现核心转储错误(信号 65 或 73)。 : define void @main() { entry: ret
我收到一个要求,其中我有一个 c 文件,并且我正在为其生成 LLVM IR。从为每条指令生成的 LLVM IR 中,我正在计算执行需要多少个周期,现在我的问题是如何追溯到 C 代码并显示特定的 C 代
我目前正在尝试运行其他人留下的 sql 命令/脚本来建立数据库。他们有这个脚本 BEGIN; \ir file.sql \ir file.sql END; 它在第一个反斜杠处给出错误。我正在使用 Po
我特别需要在我的 C++ 代码运行期间逐行解析 LLVM IR 代码,我需要知道每行的哪些操作数发生了什么操作。 例如,如果 IR 代码是: %0 = load i32* %a, align 4 我想
我是一名优秀的程序员,十分优秀!