IOReturn ApplePS2Mouse::setProperties(OSObject *props)
{
	OSDictionary *pdict = OSDynamicCast(OSDictionary, props);
    if (NULL == pdict)
        return kIOReturnError;
    
	return setParamProperties (pdict);
}
bool ApplePS2Mouse::init(OSDictionary * properties)
{
  //
  // Initialize this object's minimal state.  This is invoked right after this
  // object is instantiated.
  //
  if (!super::init(properties))  return false;

  _device                    = 0;
  _interruptHandlerInstalled = false;
  _packetByteCount           = 0;
  _packetLength              = kPacketLengthStandard;
  defres					 = 150 << 16; // (default is 150 dpi; 6 counts/mm)
  forceres					 = false;
  mouseyinverter			 = 1;   // 1 for normal, -1 for inverting
  _type                      = kMouseTypeStandard;
  _buttonCount               = 3;
  _mouseInfoBytes            = (UInt32)-1;
  ignoreall                  = false;
  ledpresent                 = false;
  resmode                    = -1;
  forcesetres                = false;
  scrollres                  = 10;
  actliketrackpad            = false;
  keytime                    = 0;
  maxaftertyping             = 500000000;
  buttonmask                 = ~0;
  scroll                     = true;
  noled                      = false;
  wakedelay                  = 1000;
    
  setParamProperties(properties);

  // remove some properties so system doesn't think it is a trackpad
  // this should cause "Product" = "Mouse" in ioreg.
  if (!actliketrackpad)
  {
    removeProperty("VendorID");
    removeProperty("ProductID");
    removeProperty("HIDPointerAccelerationType");
    removeProperty("HIDScrollAccelerationType");
    removeProperty("TrackpadScroll");
  }

  IOLog("VoodooPS2Mouse Version 1.7.6 loaded...\n");
	
  return true;
}
Пример #3
0
// RY: Override IORegistryEntry::setProperties().  This will allow properties
// to be set per device, instead of globally via setParamProperties.
IOReturn IOHIDevice::setProperties( OSObject * properties )
{
    OSDictionary * propertyDict = OSDynamicCast(OSDictionary, properties);
    IOReturn       ret          = kIOReturnBadArgument;

    if ( propertyDict ) {
        if (propertyDict->setOptions(0, 0) & OSDictionary::kImmutable) {
            OSDictionary * temp = propertyDict;
            propertyDict = OSDynamicCast(OSDictionary, temp->copyCollection());
        }
        else {
            propertyDict->retain();
        }
        propertyDict->setObject(kIOHIDDeviceParametersKey, kOSBooleanTrue);
        ret = setParamProperties( propertyDict );
        propertyDict->removeObject(kIOHIDDeviceParametersKey);
        propertyDict->release();
    }

    return ret;
}