Ejemplo n.º 1
0
bool VoodooI2CHIDDevice::probe(IOService* device) {

    
    hid_device = (I2CDevice *)IOMalloc(sizeof(I2CDevice));
    
    //hid_device->_dev = _controller->_dev;
    
    if (!super::start(device))
        return false;
    
    
    hid_device->provider = OSDynamicCast(IOACPIPlatformDevice, device);
    hid_device->provider->retain();
    
    int ret = i2c_get_slave_address(hid_device);
    if (ret < 0){
        IOLog("%s::%s::Failed to get a slave address for an I2C device, aborting.\n", getName(), _controller->_dev->name);
        IOFree(hid_device, sizeof(I2CDevice));
        return false;
    }
    
    
    IOLog("%s::%s::HID Probe called for i2c 0x%02x\n", getName(), _controller->_dev->name, hid_device->addr);
    
    initHIDDevice(hid_device);
    
    //super::stop(device);
    return 0;
}
Ejemplo n.º 2
0
int MeUsb::probeDevice()
{
  int c;
  if(!usb_online){
    USB_WR( CMD_CHECK_EXIST );
    USB_WR( 0x5A);
    c = USB_RD(); // should return 0xA5
    Serial.println(c);
    if(c!=0xA5) return 0;
    usb_online = true;
    resetBus();
  }
  
  c = getIrq();
  if(c!=USB_INT_CONNECT) return 0;
  resetBus(); // reset bus and wait the device online again
  c=0;
  while(c!=USB_INT_CONNECT){
    delay(500); // some device may need long time to get ready
    c = getIrq();
    Serial.print("waiting:");
    Serial.println(c,HEX);
  }
  if( initHIDDevice()==1)
    device_online=true;
}
Ejemplo n.º 3
0
int16_t MeUSBHost::probeDevice()
{
  int16_t c;
  if(!ch375_online){
    CH375_WR( CMD_CHECK_EXIST );
    CH375_WR( 0x5A);
    c = CH375_RD(); // should return 0xA5
    if(c!=0xA5) return 0;
    ch375_online = true;
    resetBus();
  }

  c = getIrq();
  if(c!=USB_INT_CONNECT) return 0;
  resetBus(); // reset bus and wait the device online again
  c=0;
  while(c!=USB_INT_CONNECT){
    delay(500); // some device may need long time to get ready
    c = getIrq();
#ifdef CH375_DBG
    Serial.print("waiting:");
    Serial.println(c,HEX);
#endif
  }
  if( initHIDDevice()==1)
    device_online=true;
}