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> 7 8 #include "DeviceReader.h" 9 10 #include "PointingDevice.h" 11 12 // constructor PointingDevice(MasterServerDevice * parent,DeviceReader * reader)13PointingDevice::PointingDevice(MasterServerDevice* parent, 14 DeviceReader* reader) 15 : fParent(parent), 16 fReader(reader), 17 fActive(false) 18 { 19 } 20 21 // destructor ~PointingDevice()22PointingDevice::~PointingDevice() 23 { 24 delete fReader; 25 } 26 27 // InitCheck 28 status_t InitCheck()29PointingDevice::InitCheck() 30 { 31 return fParent && fReader ? fReader->InitCheck() : B_NO_INIT; 32 } 33 34 // SetActive 35 void SetActive(bool active)36PointingDevice::SetActive(bool active) 37 { 38 fActive = active; 39 } 40 41 // IsActive 42 bool IsActive() const43PointingDevice::IsActive() const 44 { 45 return fActive; 46 } 47 48 // DevicePath 49 const char* DevicePath() const50PointingDevice::DevicePath() const 51 { 52 if (fReader) { 53 return fReader->DevicePath(); 54 } 55 return NULL; 56 } 57 58 // DisablePS2 59 bool DisablePS2() const60PointingDevice::DisablePS2() const 61 { 62 return false; 63 } 64 65 // VendorID 66 uint16 VendorID() const67PointingDevice::VendorID() const 68 { 69 if (fReader) 70 return fReader->VendorID(); 71 return 0; 72 } 73 74 // ProductID 75 uint16 ProductID() const76PointingDevice::ProductID() const 77 { 78 if (fReader) 79 return fReader->ProductID(); 80 return 0; 81 } 82 83 84 85 86 87 88