Skip to content

Instantly share code, notes, and snippets.

@TobidieTopfpflanze
Last active February 28, 2024 12:13
Show Gist options
  • Save TobidieTopfpflanze/b1d5b35c49fb0d5a4a82c6ab09706527 to your computer and use it in GitHub Desktop.
Save TobidieTopfpflanze/b1d5b35c49fb0d5a4a82c6ab09706527 to your computer and use it in GitHub Desktop.
Basic camera streaming and i2c bash usage

List i2c devices on a specific bus:

Syntax: i2cdetect [options] <busNr>

test@test-desktop:~$ i2cdetect -y -r 8
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 --
test@test-desktop:~$

Dump i2c device registers:

Syntax: i2cdump [options] <busNr> <deviceAddress>

test@test-desktop:~$ i2cdump -y -f 8 0x76
No size specified (using byte-data access)
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
00: 00 00 ff ff 00 00 ff ff XX XX XX XX XX XX XX XX ........XXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
...
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
test@test-desktop:~$

Set register value:

Syntax: i2cset [options] <busNr> <deviceAddress> <register> <address> <value>

test@test-desktop:~$ sudo i2cset -y -f 8 0x76 0x06 0x00
test@test-desktop:~$

Read register value:

Syntax: i2cget [options] <busNr> <deviceAddress> <register> <address>

test@test-desktop:~$ sudo i2cget -y -f 8 0x76 0x06
0x00
test@test-desktop:~$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment