vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / input_server / devices / wacom / PointingDevice.cpp
blobdd5a5be0f640e4c2de4499b16cca638fb04087c8
1 /*
2 * Copyright 2005-2008 Stephan Aßmus <superstippi@gmx.de>. All rights reserved.
3 * Distributed under the terms of the MIT license.
4 */
5 #include <malloc.h>
6 #include <string.h>
8 #include "DeviceReader.h"
10 #include "PointingDevice.h"
12 // constructor
13 PointingDevice::PointingDevice(MasterServerDevice* parent,
14 DeviceReader* reader)
15 : fParent(parent),
16 fReader(reader),
17 fActive(false)
21 // destructor
22 PointingDevice::~PointingDevice()
24 delete fReader;
27 // InitCheck
28 status_t
29 PointingDevice::InitCheck()
31 return fParent && fReader ? fReader->InitCheck() : B_NO_INIT;
34 // SetActive
35 void
36 PointingDevice::SetActive(bool active)
38 fActive = active;
41 // IsActive
42 bool
43 PointingDevice::IsActive() const
45 return fActive;
48 // DevicePath
49 const char*
50 PointingDevice::DevicePath() const
52 if (fReader) {
53 return fReader->DevicePath();
55 return NULL;
58 // DisablePS2
59 bool
60 PointingDevice::DisablePS2() const
62 return false;
65 // VendorID
66 uint16
67 PointingDevice::VendorID() const
69 if (fReader)
70 return fReader->VendorID();
71 return 0;
74 // ProductID
75 uint16
76 PointingDevice::ProductID() const
78 if (fReader)
79 return fReader->ProductID();
80 return 0;