Re: How to acces TVP5150 .command function from userspace

景文林 <[email protected]>
Newsgroups gmane.comp.video.video4linux
Message-ID <[email protected]>
Thank you for reply!
I`m sorry that I did not describe my problem clearly.

In tvp5150 driver,the v4l2 controls(VIDIOC_G_CTRL like)that i need are
already implemented. part of the driver as follow:
static int tvp5150_command(struct i2c_client *c,unsigned int cmd, void *arg)
{
    struct tvp5150 *decoder = i2c_get_clientdata(c);

    switch (cmd) {

    case 0:
    case VIDIOC_INT_RESET:
    ...
    case VIDIOC_G_CTRL:
    ...
}
static struct i2c_driver driver = {
    .driver = {
        .name = "tvp5150",
    },
    .id = I2C_DRIVERID_TVP5150,

    .attach_adapter = tvp5150_attach_adapter,
    .detach_client = tvp5150_detach_client,

    .command = tvp5150_command,
};

I want to access the tvp5150_command function in userland . I opened
/dev/i2c-0 and called ioctl like that:
if (ioctl(file,I2C_SLAVE_FORCE,addr) < 0) {    /*addr is tvp5150 address*/
    exit(1);
 }

 if (ioctl(file,VIDIOC_G_CTRL,addr) < 0)
...
It`s absolute wrong but I don`t know how to call VIDIOC_G_CTRL control.

Regards,
william











2009/5/23 Markus Rechberger <[email protected]>

> 2009/5/22 Devin Heitmueller <[email protected]>:
> > On Fri, May 22, 2009 at 3:50 AM, 景文林 <[email protected]> wrote:
> >> Hi,
> >>
> >> I am working with a video capture chip TVP5150. I want to adjust the
> >> "Brightness" "Contrast" "Saturation" and "hue" in user space.
> >> In TVP5150 drivers ,the V4l2 commands are in function
> tvp5150_command.And
> >> this function is a member of struct i2c_device.
> >>
> >> The linux is 2.6.19.2.
> >> I write my code according kernel document
>  Documentation/i2c/dev-interface
> >> But I can`t access tvp5150_command.
> >> How can i acces i2c_device .command  function from user space?
> >
> > I thought those controls were already implemented in the tvp5150
> > driver, although I could be mistaken (I would have to look at the
> > code).  If not, it would probably be much easier to just add the
> > commands to the driver than to attempt to program the chip from
> > userland (the datasheet for the tvp5150 is freely available).
> >
>
> those are definitely implemented, I remember there was a problem with
> a too dark videopicture years ago and it was a bug in the tvp5150...
>
> Also by looking at it:
> V4L2_CID_BRIGHTNESS
> V4L2_CID_CONTRAST
> V4L2_CID_SATURATION
> V4L2_CID_HUE
>
> are supported.
>
> Markus
>
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.