Yes I have. Anyway i'm trying to read a value of a register of TVP5150.
Is this the correct way??

if(ioctl(fd, I2C_SLAVE, (0xB8)>>1) < 0) {
    fprintf( stderr, "Failed to set slave address: %m\n" );
     exit(1);
   }
    /* Using I2C Read, equivalent of i2c_smbus_read_byte(file) */
   if (read(fd, buf, 1) != 1) {
     perror("Read");
     /* ERROR HANDLING: i2c transaction failed */
   } else {
     printf("%x",buf[0]);
     /* buf[0] contains the read byte */
   }

this code is not giving any error but the value being returned is not
correct. Is there
anythng else i need to do!!!!!!!!!!

thanks & regards
yuvraj

---------- Forwarded message ----------
From: Deepika Makhija <[email protected]>
Date: Tue, Sep 22, 2009 at 12:47 PM
Subject: Re: tvp5150 not responding
To: Yuvraj Pasi <[email protected]>


 Hi,

Have you allocated the memory for funcs pointer?
or else can you try this

unsigned long funcs;
if(ioctl(fd, I2C_FUNCS, &funcs)<0) {
    perror("ioctl");
    /* ERROR HANDLING: i2c transaction failed */
}

Regards,
Deepika Makhija


Yuvraj Pasi wrote:

ok Thanks for pointing out my mistake. now it is giving a different error.
i did

unsigned long *funcs;
if(ioctl(fd, I2C_FUNCS, funcs)<0) {
    perror("ioctl");
    /* ERROR HANDLING: i2c transaction failed */
}

Now it says
ioctl: Bad address

i guess either the address is still incorrect or there is problem with I2C
interface of TVP5150.

thanks & regards
yuvraj

On Tue, Sep 22, 2009 at 11:41 AM, Deepika Makhija <
[email protected]> wrote:

>  Hi,
>
> I2C driver accepts 7-bit address so,
>
> Instead of  ioctl(fd, I2C_SLAVE, 0xB8) < 0)
> use
>     ioctl(fd, I2C_SLAVE, (0xB8 >> 1)) < 0)
>
> Regards,
> Deepika
>
>
>
> Yuvraj Pasi wrote:
>
>  Hi,
> I am trying to test tvp5150 with my board from userspace. i have written a
> small program using example given in I2C documentation.
> after opening file
> fd = open ("/dev/i2c/1", O_RDWR );
>
> when i do
> if (ioctl(fd, I2C_SLAVE, 0xB8) < 0)
>
> the system returns
> Failed to set slave address: Invalid argument
>
> the B8 is the I2C address given in the tvp5150 datasheet. is it correct or
> is there somthing i'm missing???
>
>
> thanks & regards
> yuvraj
>
>
>    *Email Scanned for Virus & Dangerous Content by :* *
> www.CleanMailGateway.com*
>
> ------------------------------
>
> _______________________________________________
> Davinci-linux-open-source mailing 
> [email protected]http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
>
>
> --
> ------------------------------
>  Disclaimer: This e-mail message and all attachments transmitted with it
> are intended solely for the use of the addressee and may contain legally
> privileged and confidential information. If the reader of this message is
> not the intended recipient, or an employee or agent responsible for
> delivering this message to the intended recipient, you are hereby notified
> that any dissemination, distribution, copying, or other use of this message
> or its attachments is strictly prohibited. If you have received this message
> in error, please notify the sender immediately by replying to this message
> and please delete it from your computer. Any views expressed in this message
> are those of the individual sender unless otherwise stated.Company has taken
> enough precautions to prevent the spread of viruses. However the company
> accepts no liability for any damage caused by any virus transmitted by this
> email.
> ------------------------------
>
>


  *Email Scanned for Virus & Dangerous Content by :* *
www.CleanMailGateway.com*

------------------------------

_______________________________________________
Davinci-linux-open-source mailing
[email protected]http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


-- 
------------------------------
 Disclaimer: This e-mail message and all attachments transmitted with it are
intended solely for the use of the addressee and may contain legally
privileged and confidential information. If the reader of this message is
not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified
that any dissemination, distribution, copying, or other use of this message
or its attachments is strictly prohibited. If you have received this message
in error, please notify the sender immediately by replying to this message
and please delete it from your computer. Any views expressed in this message
are those of the individual sender unless otherwise stated.Company has taken
enough precautions to prevent the spread of viruses. However the company
accepts no liability for any damage caused by any virus transmitted by this
email.
------------------------------
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to