OpenIPC / ipctool

Simple tool (and library) for checking IP camera hardware
https://openipc.org
MIT License
158 stars 34 forks source link

i2cdump does not show last register byte #113

Closed RoboSchmied closed 6 months ago

RoboSchmied commented 6 months ago

last byte of requested sequence is missing

ipctool i2cdump 0x60 0x3107 0x3109 shows only 2 of 3 register bytes CB 3E . The last byte of the register is always skipped:

root@openipc-gk7205v210:/tmp# ./ipctool i2cdump 0x60 0x3107 0x3109
       0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
CB  3E

But output should be (in my case) CB 3E 01. Even though we can get the output we want by incrementing the to-register by 1, the last register will never be readable by i2cdump.

In other words: source

ipctool is kinda stupid and does not include the last region in the sequence

code problem

for (size_t i = from_reg_addr; i < to_reg_addr; ++i) {

solution

for (size_t i = from_reg_addr; i <= to_reg_addr; ++i) {