提交 b3e440ee 编写于 作者: T Theodore Kilgore 提交者: Mauro Carvalho Chehab

V4L/DVB (13139): gspca_mr97310a: Improve VGA sensor type detection

Improve (and also simplify :) gspca_mr97310a: VGA sensor type detection.
As it was still failing on some machines (not with some cams, but on
some machines interesting enough).
Signed-off-by: NTheodore Kilgore <kilgota@banach.math.auburn.edu>
Signed-off-by: NHans de Goede <hdegoede@redhat.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 85191100
...@@ -431,12 +431,13 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -431,12 +431,13 @@ static int sd_config(struct gspca_dev *gspca_dev,
if (err_code < 0) if (err_code < 0)
return err_code; return err_code;
err_code = stream_start(gspca_dev);
if (err_code < 0)
return err_code;
if (id->idProduct == 0x010e) { if (id->idProduct == 0x010e) {
sd->cam_type = CAM_TYPE_CIF; sd->cam_type = CAM_TYPE_CIF;
cam->nmodes--; cam->nmodes--;
err_code = stream_start(gspca_dev);
if (err_code < 0)
return err_code;
err_code = cam_get_response16(gspca_dev, 0x06, 1); err_code = cam_get_response16(gspca_dev, 0x06, 1);
if (err_code < 0) if (err_code < 0)
return err_code; return err_code;
...@@ -476,74 +477,52 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -476,74 +477,52 @@ static int sd_config(struct gspca_dev *gspca_dev,
} else { } else {
sd->cam_type = CAM_TYPE_VGA; sd->cam_type = CAM_TYPE_VGA;
/* err_code = cam_get_response16(gspca_dev, 0x07, 1);
* VGA cams also have two different sensor types. Detection
* requires a two-step process.
*
* Here is a report on the result of the first test for the
* known MR97310a VGA cameras. If you have another to report,
* please do.
*
* Name byte just read sd->sensor_type
* sd->do_lcd_stop
* Aiptek Pencam VGA+ 0x31 0 1
* ION digital 0x31 0 1
* Sakar Digital 77379 0x31 0 1
* Argus DC-1620 0x30 1 0
* Argus QuickClix 0x30 1 1 (see note)
* Note that this test fails to distinguish sd->sensor_type
* for the two cameras which have reported 0x30.
* Another test will be run on them.
* But the sd->do_lcd_stop setting is needed, too.
*/
err_code = cam_get_response16(gspca_dev, 0x20, 1);
if (err_code < 0)
return err_code;
sd->sensor_type = gspca_dev->usb_buf[0] & 1;
sd->do_lcd_stop = (~gspca_dev->usb_buf[0]) & 1;
err_code = stream_start(gspca_dev);
if (err_code < 0) if (err_code < 0)
return err_code; return err_code;
/* /*
* A second test can now resolve any remaining ambiguity in the * Here is a table of the responses to the previous command
* identification of the camera's sensor type. Specifically, * from the known MR97310A VGA cameras.
* it now gives the correct sensor_type for the Argus DC-1620
* and the Argus QuickClix.
*
* This second test is only run if needed,
* but additional results from testing some other cameras
* are recorded here, too:
* *
* Name gspca_dev->usb_buf[] sd->sensor_type * Name gspca_dev->usb_buf[] sd->sensor_type
* sd->do_lcd_stop
* Aiptek Pencam VGA+ 0300 0 1
* ION digital 0350 0 1
* Argus DC-1620 0450 1 0
* Argus QuickClix 0420 1 1
* *
* Aiptek Pencam VGA+ 0300 (test not needed) 1 * Based upon these results, we assume default settings
* ION digital 0350 (test not needed) 1 * and then correct as necessary, as follows.
* Argus DC-1620 0450 (remains as type 0) 0
* Argus QuickClix 0420 (corrected to type 1) 1
* *
* This test even seems able to distinguish one VGA cam from
* another which may be useful. However, the CIF type 1 cameras
* do not like it.
*/ */
if (!sd->sensor_type) { sd->sensor_type = 1;
err_code = cam_get_response16(gspca_dev, 0x07, 1); sd->do_lcd_stop = 0;
if (err_code < 0) if ((gspca_dev->usb_buf[0] != 0x03) &&
return err_code; (gspca_dev->usb_buf[0] != 0x04)) {
PDEBUG(D_ERR, "Unknown VGA Sensor id Byte 0: %02x",
gspca_dev->usb_buf[1]);
PDEBUG(D_ERR, "Defaults assumed, may not work");
PDEBUG(D_ERR, "Please report this");
}
if (gspca_dev->usb_buf[0] == 0x04) {
sd->do_lcd_stop = 1;
switch (gspca_dev->usb_buf[1]) { switch (gspca_dev->usb_buf[1]) {
case 0x50: case 0x50:
sd->sensor_type = 0;
PDEBUG(D_PROBE, "sensor_type corrected to 0");
break; break;
case 0x20: case 0x20:
sd->sensor_type = 1; /* Nothing to do here. */
PDEBUG(D_PROBE, "sensor_type corrected to 1");
break; break;
default: default:
PDEBUG(D_ERR, "Unknown VGA Sensor id : %02x", PDEBUG(D_ERR,
gspca_dev->usb_buf[1]); "Unknown VGA Sensor id Byte 1: %02x",
return -ENODEV; gspca_dev->usb_buf[1]);
PDEBUG(D_ERR,
"Defaults assumed, may not work");
PDEBUG(D_ERR, "Please report this");
} }
} }
PDEBUG(D_PROBE, "MR97310A VGA camera detected, sensor: %d", PDEBUG(D_PROBE, "MR97310A VGA camera detected, sensor: %d",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册