Hallo,
ich versuche schon seit gut 4 wochen via Cross-compile ein einfaches programm zuerstellen das eigentlich so gehen sollte.
C
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <linux/i2c-dev.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#define LCD 254
int main()
{
int fd=open("/dev/i2c/1", O_RDWR); //open 2nd bus
perror("open ");
ioctl( fd,I2C_SLAVE,LCD);
perror("ioctl ");
write(fd, "2", 1);
perror("write ");
close(fd);
return 0;
}
Alles anzeigen
Dieses Porgramm soll eine Verbindung zum I2c anschluss am MiniDin aufbaun und denn wert "2" an das SlaveDevice mit der Slaveid 254 senden.
Aber ioctl meint irgend wie probleme zumachen.
Code
root@dm7025:/media/hdd/apps# ./test
open : Success
ioctl : Invalid argument <<<<<<< ??????????
write : Remote I/O error
root@dm7025:/media/hdd/apps#
wenn ich aber als I2C adresse z.B 62 angebe kommt dort "illegal seek"
Ich würde mich sehr freuen wenn sich jemand mal dem annehmen könnte und mir hilft.
Danke