xref: /haiku/src/add-ons/media/media-add-ons/usb_webcam/sensors/hdcs1000.cpp (revision 2600324b57fa31cdea1627d584d314f2a579c4a8)
1 /*
2  * Copyright 2004-2008, François Revol, <revol@free.fr>.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include "CamSensor.h"
7 #include "CamDebug.h"
8 
9 #define HDCS_ADDR_QC	0xaa
10 
11 #define HDCS_IDENT	0x00
12 
13 class HDCS1000Sensor : public CamSensor {
14 public:
15 	HDCS1000Sensor(CamDevice *_camera);
16 	~HDCS1000Sensor();
17 
18 	virtual status_t	Probe();
19 
20 	virtual uint8		IICReadAddress() const { return HDCS_ADDR_QC; };
21 	virtual uint8		IICWriteAddress() const { return HDCS_ADDR_QC; };
22 };
23 
24 
25 HDCS1000Sensor::HDCS1000Sensor(CamDevice *_camera)
26 : CamSensor(_camera)
27 {
28 }
29 
30 
31 HDCS1000Sensor::~HDCS1000Sensor()
32 {
33 }
34 
35 
36 status_t
37 HDCS1000Sensor::Probe()
38 {
39 	status_t err;
40 	uint8 data;
41 	PRINT((CH "()" CT));
42 	Device()->SetIICBitsMode(8);
43 	// QuickCam only ?
44 	err = Device()->ReadIIC8(HDCS_IDENT+1, &data);
45 	if (err < B_OK)
46 		return ENODEV;
47 	if (data == 8) {
48 		PRINT((CH ": found %s sensor!" CT, Name()));
49 		return B_OK;
50 	}
51 	return ENODEV;
52 }
53 
54 
55 B_WEBCAM_DECLARE_SENSOR(HDCS1000Sensor, hdcs1000)
56 
57