Based on the i2cdetect.c (a user-space program to scan for I2C devices) which can be found in most Linux distributions, I wrote a similar utility for the bcm2835 library.
The source code can be found here :
https://github.com/vanvught/OpenDMX/blob/master/bw_i2cdetect/src/i2cdetect.cor here :
https://github.com/vanvught/OpenILDA/blob/master/bw_i2cdetect/src/i2cdetect.cSample output:
pi@raspberrypi /opt/data/development/workspace/bw_i2cdetect/src $ gcc -O3 -Wall -o i2cdetect i2cdetect.c -l bcm2835
pi@raspberrypi /opt/data/development/workspace/bw_i2cdetect/src $ ls -al
total 44
drwxrwxr-x 1 pi pi 40 Jan 8 12:14 .
drwxrwxr-x 1 pi pi 54 Jan 7 12:01 ..
-rwxr-xr-x 1 pi pi 39733 Jan 8 12:14 i2cdetect
-rwxrwxrwx 1 pi pi 2392 Jan 7 12:16 i2cdetect.c
pi@raspberrypi /opt/data/development/workspace/bw_i2cdetect/src $ sudo ./i2cdetect
0x41 : 0x82 : BW:LCD
0x4A : 0x94 : BW:User Interface (UI)
0x57 : 0xAE : MCP7941X {EEPROM}
0x6F : 0xDE : MCP7941X {SRAM RTCC}
The second column displays the address as used by BitWizard -->
http://www.bitwizard.nl/wiki/index.php/I2c_addressesYou canadd other devices to list by editing the following:
struct device_details {
char slave_address;
const char *name;
} const devices[] = {
{ 0x41, "BW:LCD" },
{ 0x4A, "BW:User Interface (UI)" },
{ 0x57, "MCP7941X {EEPROM}" },
{ 0x6F, "MCP7941X {SRAM RTCC}" }
};Thanks, Arjan