IOReturn ApplePS2Mouse::setParamProperties(OSDictionary* dict)
{
    ////IOReturn result = super::IOHIDevice::setParamProperties(dict);
    if (_cmdGate)
    {
        // syncronize through workloop...
        ////_cmdGate->runAction(OSMemberFunctionCast(IOCommandGate::Action, this, &ApplePS2Mouse::setParamPropertiesGated), dict);
        setParamPropertiesGated(dict);
    }
    
    return super::setParamProperties(dict);
    ////return result;
}
Пример #2
0
/******************************************************************************
 * CodecCommander::init - parse kernel extension Info.plist
 ******************************************************************************/
bool CodecCommander::init(OSDictionary *dict)
{
    DEBUG_LOG("CodecCommander: cc: commander initializing\n");
    
    if (!super::init(dict))
        return false;
    
    fWorkLoop = 0;
    fTimer = 0;
    
    generatePop = false;
    checkInfinite = false;
    eapdPoweredDown = true;
    coldBoot = true; // assume booting from cold since hibernate is broken on most hacks
    hdaCurrentPowerState = 0x0; // assume hda codec has no power at cold boot
    hdaPrevPowerState = hdaCurrentPowerState; //and previous state was the same
    
    // get configuration
    OSDictionary* list = OSDynamicCast(OSDictionary, dict->getObject(kConfiguration));
    OSDictionary* config = CodecCommander::makeConfigurationNode(list);
    
    // set configuration
    setParamPropertiesGated(config);
    OSSafeRelease(config);
    
    // set path for ioreg entries
    snprintf(hdaDevicePath, sizeof(hdaDevicePath),
             "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/HDEF@1B");
    snprintf(hdaDriverPath,sizeof(hdaDriverPath),
             "%s/AppleHDAController@1B/IOHDACodecDevice@1B,%d/IOHDACodecDriver/IOHDACodecFunction@1B,%d,1/AppleHDACodecGeneric/AppleHDADriver",
             hdaDevicePath,codecNumber,codecNumber);
    snprintf(engineOutputPath,sizeof(engineOutputPath),
             "%s/AppleHDAController@1B/IOHDACodecDevice@1B,%d/IOHDACodecDriver/IOHDACodecFunction@1B,%d,1/AppleHDACodecGeneric/AppleHDADriver/AppleHDAEngineOutput@1B,%d,1,%d",
             hdaDevicePath,codecNumber,codecNumber,codecNumber,outputNumber);
    
    // set codec address and node number for EAPD status set
    spCommandWrite = (codecNumber << 28) | (spNodeNumber << 20) | 0x70c02;
    hpCommandWrite = (codecNumber << 28) | (hpNodeNumber << 20) | 0x70c02;
    
    // set codec address and node number for EAPD status get
    spCommandRead  = (codecNumber << 28) | (spNodeNumber << 20) | 0xf0c00;
    hpCommandRead  = (codecNumber << 28) | (hpNodeNumber << 20) | 0xf0c00;
    
    // commands for simulating headphone jack plugging and unplugging
    shpCommandEnable  = (codecNumber << 28) | (shpNodeNumber << 20) | 0x707c0;
    shpCommandDisable = (codecNumber << 28) | (shpNodeNumber << 20) | 0x70700;
    
    return true;
}
bool ApplePS2Mouse::init(OSDictionary * dict)
{
  //
  // Initialize this object's minimal state.  This is invoked right after this
  // object is instantiated.
  //
    
  if (!super::init(dict))
      return false;

  // find config specific to Platform Profile
  OSDictionary* list = OSDynamicCast(OSDictionary, dict->getObject(kPlatformProfile));
  OSDictionary* config = ApplePS2Controller::makeConfigurationNode(list);
  if (config)
  {
      // if DisableDevice is Yes, then do not load at all...
      OSBoolean* disable = OSDynamicCast(OSBoolean, config->getObject(kDisableDevice));
      if (disable && disable->isTrue())
      {
          config->release();
          return false;
      }
#ifdef DEBUG
      // save configuration for later/diagnostics...
      setProperty(kMergedConfiguration, config);
#endif
  }

  // initialize state...
  _device                    = 0;
  _interruptHandlerInstalled = false;
  _packetByteCount           = 0;
  _lastdata                  = 0;
  _packetLength              = kPacketLengthStandard;
  defres					 = 150 << 16; // (default is 150 dpi; 6 counts/mm)
  forceres					 = false;
  mouseyinverter			 = 1;   // 1 for normal, -1 for inverting
  scrollyinverter            = 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;
  usb_mouse_stops_trackpad   = true;
  mousecount                 = 0;
  _cmdGate = 0;
    
  // state for middle button
  _buttonTimer = 0;
  _mbuttonstate = STATE_NOBUTTONS;
  _pendingbuttons = 0;
  _buttontime = 0;
  _maxmiddleclicktime = 100000000;
 
  // load settings
  setParamPropertiesGated(config);
  OSSafeRelease(config);

  // 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.8.5 loaded...\n");
	
  return true;
}