Пример #1
0
 /**
  * Stop the device
  *
  * @throws DriverException
  */
 protected void stopDevice() throws DriverException {
   final Device dev = getDevice();
   if (acpiDevice != null) {
     dev.getManager().unregister(acpiDevice);
   }
   dev.unregisterAPI(FirmwareAPI.class);
 }
Пример #2
0
  /**
   * Start the device
   *
   * @throws DriverException
   */
  protected void startDevice() throws DriverException {
    final Device dev = getDevice();

    // Find the ACPI info
    try {
      final ResourceManager rm;
      rm = InitialNaming.lookup(ResourceManager.NAME);
      info = findAcpiRSDTPTR(rm);
    } catch (NameNotFoundException ex) {
      throw new DriverException("Cannot find the resource manager");
    } catch (ResourceNotFreeException ex) {
      log.error("Cannot claim BIOS region", ex);
    }

    // Register out API
    dev.registerAPI(FirmwareAPI.class, this);

    // Start an ACPI device if we found the info for it.
    if (info != null) {
      log.info("Start ACPI device");
      acpiDevice = new AcpiDevice(dev.getBus(), "acpi", info);
      try {
        dev.getManager().register(acpiDevice);
      } catch (DeviceAlreadyRegisteredException ex) {
        log.error("Cannot register ACPI device", ex);
      }
    }
  }
Пример #3
0
  /** @see org.jnode.driver.Driver#startDevice() */
  protected void startDevice() throws DriverException {
    final Device ideDev = getDevice();

    // Register my api's
    ideDev.registerAPI(SCSIHostControllerAPI.class, this);

    // Create the ATAPI bus
    this.atapiBus = new ATAPIBus(ideDev);

    // Create the generic SCSI device, attached to the ATAPI bus
    scsiDevice = new ATAPISCSIDevice(atapiBus, "_sg");

    // Execute INQUIRY
    try {
      scsiDevice.inquiry();
    } catch (SCSIException ex) {
      throw new DriverException("Cannot INQUIRY device due to SCSIException", ex);
    } catch (TimeoutException ex) {
      throw new DriverException("Cannot INQUIRY device due to TimeoutException", ex);
    } catch (InterruptedException ex) {
      throw new DriverException("Interrupted while INQUIRY device", ex);
    }

    // Register the generic SCSI device.
    try {
      final DeviceManager dm = ideDev.getManager();
      synchronized (dm) {
        dm.rename(scsiDevice, "sg", true);
        dm.register(scsiDevice);
        dm.rename(ideDev, SCSIHostControllerAPI.DEVICE_PREFIX, true);
      }
    } catch (DeviceAlreadyRegisteredException ex) {
      throw new DriverException(ex);
    }
  }
Пример #4
0
  /** @see org.jnode.driver.Driver#stopDevice() */
  protected void stopDevice() throws DriverException {
    final Device ideDev = getDevice();

    // Unregister the SCSI device
    try {
      ideDev.getManager().unregister(scsiDevice);
    } finally {
      scsiDevice = null;
      atapiBus = null;
    }

    // Unregister my api's
    ideDev.unregisterAPI(SCSIHostControllerAPI.class);
  }