Package org.jnode.driver

Examples of org.jnode.driver.DeviceManager


                    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];
View Full Code Here


   
    public void execute() throws NameNotFoundException, ApiNotFoundException, NetworkException {
        PrintWriter out = getOutput().getPrintWriter();
        if (!argDevice.isSet()) {
            // Print MAC address, MTU and IP address(es) for all network devices.
            final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
            for (Device dev : dm.getDevicesByAPI(NetDeviceAPI.class)) {
                final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
                out.format(fmt_devices, dev.getId(), api.getAddress(), api.getMTU(),
                           api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
            }
        } else {
View Full Code Here

     * @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);
        }
View Full Code Here

    /**
     * @see org.jnode.plugin.Plugin#startPlugin()
     */
    protected void startPlugin() throws PluginException {
        try {
            final DeviceManager dm = DeviceUtils.getDeviceManager();
            dm.addListener(this);
            final Collection<Device> devs = new ArrayList<Device>(dm.getDevices());
            for (Device dev : devs) {
                addListeners(dev);
            }
        } catch (NameNotFoundException ex) {
            throw new PluginException(ex);
View Full Code Here

    /**
     * @see org.jnode.plugin.Plugin#stopPlugin()
     */
    protected void stopPlugin() throws PluginException {
        try {
            final DeviceManager dm = DeviceUtils.getDeviceManager();
            dm.removeListener(this);
            final Collection<Device> devs = dm.getDevices();
            for (Device dev : devs) {
                removeListeners(dev);
            }
        } catch (NameNotFoundException ex) {
            throw new PluginException(ex);
View Full Code Here

    /**
     * Unregister all PCI devices from the device manager.
     */
    public void stopDevice() throws DriverException {
        // Stop & unregister all PCI devices
        DeviceManager devMan;
        try {
            devMan = InitialNaming.lookup(DeviceManager.NAME);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find device manager", ex);
        }
        for (PCIDevice dev : devices) {
            log.debug("Stopping and unregistering device " + dev.getId());
            try {
                devMan.unregister(dev);
            } catch (DriverException ex) {
                throw new DriverException("Driver exception during unregister",
                    ex);
            }
        }
View Full Code Here

        // Remap all devices
        remapDeviceAddresses(devices);

        // Register all bridges
        final DeviceManager devMan = getDevice().getManager();
        for (PCIDevice dev : devices) {
            if (dev.isBridge()) {
                try {
                    devMan.register(dev);
                } catch (DeviceAlreadyRegisteredException ex) {
                    log.error("Cannot start " + dev.getId(), ex);
                } catch (DriverException ex) {
                    log.error("Cannot start " + dev.getId(), ex);
                }
            }
        }
        // Register all non-bridges
        for (final PCIDevice dev : devices) {
            if (!dev.isBridge()) {
                WorkUtils.add(new Work(dev.getId()) {
                    public void execute() {
                        try {
                            devMan.register(dev);
                        } catch (DeviceAlreadyRegisteredException ex) {
                            log.error("Cannot start " + dev.getId(), ex);
                        } catch (DriverException ex) {
                            log.error("Cannot start " + dev.getId(), ex);
                        }
View Full Code Here

    }

    final List<Device> getDevices() throws OSFacadeException {
        List<Device> devices = new ArrayList<Device>();
        try {
            DeviceManager devMan = org.jnode.driver.DeviceUtils.getDeviceManager();
            for (org.jnode.driver.Device dev : devMan.getDevicesByAPI(REQUIRED_API)) {
                Device device = createDevice(dev);
                if (device != null) {
                    devices.add(device);
                }
            }
View Full Code Here

        if (api != null) {
            this.devMan = null;
            this.api = api;
            this.api.addKeyboardListener(this);
        } else {
            DeviceManager dm = null;
            try {
                dm = InitialNaming.lookup(DeviceManager.NAME);
                dm.addListener(this);
            } catch (NameNotFoundException ex) {
                BootLogInstance.get().error("DeviceManager not found", ex);
            }
            this.devMan = dm;
        }
View Full Code Here

TOP

Related Classes of org.jnode.driver.DeviceManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.