* i2c fo romap5912 help!
[not found] <20061224180003.6A3BE8062A@linux.omap.com>
@ 2006-12-28 8:33 ` 李玮
0 siblings, 0 replies; only message in thread
From: 李玮 @ 2006-12-28 8:33 UTC (permalink / raw)
To: linux-omap-open-source
[-- Attachment #1: Type: text/plain, Size: 873 bytes --]
Hi,
I am using an osk5912 and would like to light the led D3
on the board thru the i2c driver.Now I have seen the dev file
under the /dev and can open the file /dev/i2c,but when i use ioctl
to set i2c, it says that Device or resoure busy.Please help me!
thanks!
my test program is fellowed.
#define I2C_SLAVE 0x0703
int main(void)
{
int file;
int
int adapter_nr=0;
int addr = 0x48;
char filename[20] = {0};
sprintf(filename,"/dev/i2c-%d",adapter_nr);
if ((file = open("/dev/i2c/0",O_RDWR)) < 0);
{
perror("err");
exit(1);
}
if(ioctl(file,I2C_SLAVE,addr) < 0 )
{
perror("err");
// exit(1);
}
int reg = 0x10;
char buf[10]={0};
buf[0] = reg;
buf[1] = 0x43;
buf[2] = 0x65;
abc = write(file,buf,3);
printf("the abc is %d\n",abc);
close(file);
return 0;
}
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-12-28 8:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20061224180003.6A3BE8062A@linux.omap.com>
2006-12-28 8:33 ` i2c fo romap5912 help! 李玮
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.