This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <linux/i2c-dev.h> | |
#include <i2c/smbus.h> | |
#include <sys/ioctl.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <stdbool.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct b { | |
int mb1[5]; | |
} b; | |
typedef struct a { | |
int ma1; | |
b ma2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Insert driver simulating an i2c bus, | |
# with two devices at addresses 0x48 and 0x49 | |
# (see datasheets for the LM75 and LM77 temp sensors) | |
modprobe i2c-stub chip_addr=0x48,0x49 | |
# Extract i2c-stub bus number from i2cdetect | |
bus_number=$(i2cdetect -l | grep -i stub | awk -F' ' '{print $1;}' - | cut -d"-" -f2) | |