/** * 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); }
/** * 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); } } }
/** @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); } }
/** @see org.jnode.driver.Driver#startDevice() */ protected void startDevice() throws DriverException { final Device device = getDevice(); try { final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME); dm.rename(device, getDevicePrefix() + "-" + device.getId(), false); } catch (DeviceAlreadyRegisteredException ex) { log.error("Cannot rename device", ex); } catch (NameNotFoundException ex) { throw new DriverException("Cannot find DeviceManager", ex); } device.registerAPI(FrameBufferAPI.class, this); }
public static void main(String[] args) throws Exception { final String devId = (args.length > 0) ? args[0] : "" /*"fb0"*/; Surface g = null; try { Device dev = null; if ("".equals(devId)) { final Collection<Device> devs = DeviceUtils.getDevicesByAPI(FrameBufferAPI.class); int dev_count = devs.size(); if (dev_count > 0) { Device[] dev_a = devs.toArray(new Device[dev_count]); dev = dev_a[0]; } } if (dev == null) { final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME); dev = dm.getDevice(devId); } final FrameBufferAPI api = dev.getAPI(FrameBufferAPI.class); final FrameBufferConfiguration conf = api.getConfigurations()[0]; g = api.open(conf); TextScreenConsoleManager mgr = new TextScreenConsoleManager(); ScrollableTextScreen ts = new FBConsole.FBPcTextScreen(g).createCompatibleScrollableBufferScreen(500); ScrollableTextScreenConsole first = new ScrollableTextScreenConsole( mgr, "console", ts, ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE); mgr.registerConsole(first); mgr.focus(first); new CommandShell(first).run(); Thread.sleep(60 * 1000); } catch (Throwable ex) { log.error("Error in FBConsole", ex); } finally { if (g != null) { log.info("Close graphics"); g.close(); } } }
/** @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); }
public synchronized void apply() { try { config.apply(device); } catch (NetworkException ex) { ConfigurationProcessor.log.error("Cannot configure device " + device.getId(), ex); } finally { ready = true; this.notifyAll(); } }
/** @see java.net.SocketOptions#getOption(int) */ public final synchronized Object getOption(int option_id) throws SocketException { if (closed) { throw new SocketException("DatagramSocket closed"); } switch (option_id) { case IP_TOS: return tos; case SO_BINDADDR: return laddr; case SO_BROADCAST: return broadcast; case SO_RCVBUF: return EthernetConstants.ETH_FRAME_LEN; case SO_SNDBUF: return EthernetConstants.ETH_FRAME_LEN; case SO_TRANSMIT_IF: return (device == null) ? null : NetworkInterface.getByName(device.getId()); case SO_TIMEOUT: return timeout; default: return doGetOption(option_id); } }
/** @see org.jnode.driver.Driver#stopDevice() */ protected void stopDevice() throws DriverException { final Device dev = getDevice(); dev.unregisterAPI(FrameBufferAPI.class); }
/** @see java.net.VMNetDevice#getId() */ public String getId() { return device.getId(); }