Skip to content

Commit 96aaa44

Browse files
authored
fix i2cdump output on last line (#123)
closes #122 Signed-off-by: RoboSchmied <[email protected]>
1 parent c765f48 commit 96aaa44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/i2cspi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ static void hexdump(read_register_t cb, int fd, unsigned char i2c_addr,
141141
} else {
142142
ascii[i % 16] = '.';
143143
}
144-
if ((i + 1) % 8 == 0 || i + 1 == size) {
144+
if ((i + 1) % 8 == 0 || i == size) {
145145
printf(" ");
146146
if ((i + 1) % 16 == 0) {
147147
printf("| %s \n", ascii);
148-
} else if (i + 1 == size) {
148+
} else if (i == size) {
149149
ascii[(i + 1) % 16] = '\0';
150150
if ((i + 1) % 16 <= 8) {
151151
printf(" ");

0 commit comments

Comments
 (0)