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