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