summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-12-14 09:48:07 +0100
committerJean-Francois Moine <moinejf@free.fr>2008-12-14 09:48:07 +0100
commitf74cfcac767db1991854892ac24f5ff39596b851 (patch)
tree8d92ea09703165511a672aa1c7f1f7ecb5e00ea2 /linux
parentf5fcababcd2cc816a001298326635ea7c52b1cbd (diff)
downloadmediapointer-dvb-s2-f74cfcac767db1991854892ac24f5ff39596b851.tar.gz
mediapointer-dvb-s2-f74cfcac767db1991854892ac24f5ff39596b851.tar.bz2
gspca - ov534: Show sensor ID.
From: Antonio Ospite <ospite@studenti.unina.it> The original version of sccb_read_reg() is from Jim Paris. NOTE: as it is now reading sensor ID won't work for sensors on different i2c slave address. Priority: normal Signed-off-by: Antonio Ospite <ospite@studenti.unina.it> Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/video/gspca/ov534.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/linux/drivers/media/video/gspca/ov534.c b/linux/drivers/media/video/gspca/ov534.c
index edcd92557..ad97b0be5 100644
--- a/linux/drivers/media/video/gspca/ov534.c
+++ b/linux/drivers/media/video/gspca/ov534.c
@@ -149,6 +149,20 @@ static void sccb_reg_write(struct usb_device *udev, u16 reg, u8 val)
PDEBUG(D_ERR, "sccb_reg_write failed");
}
+static u8 sccb_reg_read(struct usb_device *udev, u16 reg)
+{
+ ov534_reg_write(udev, OV534_REG_SUBADDR, reg);
+ ov534_reg_write(udev, OV534_REG_OPERATION, OV534_OP_WRITE_2);
+ if (!sccb_check_status(udev))
+ PDEBUG(D_ERR, "sccb_reg_read failed 1");
+
+ ov534_reg_write(udev, OV534_REG_OPERATION, OV534_OP_READ_2);
+ if (!sccb_check_status(udev))
+ PDEBUG(D_ERR, "sccb_reg_read failed 2");
+
+ return ov534_reg_read(udev, OV534_REG_READ);
+}
+
static const __u8 ov534_reg_initdata[][2] = {
{ 0xe7, 0x3a },
@@ -339,6 +353,9 @@ static void ov534_setup(struct usb_device *udev)
ov534_reg_write(udev, ov534_reg_initdata[i][0],
ov534_reg_initdata[i][1]);
+ PDEBUG(D_PROBE, "sensor is ov%02x%02x",
+ sccb_reg_read(udev, 0x0a), sccb_reg_read(udev, 0x0b));
+
ov534_set_led(udev, 1);
/* Initialize sensor */