Package org.jnode.driver

Examples of org.jnode.driver.Device


        }
        if (kernel != null) {
            kernel.release();
            kernel = null;
        }
        final Device dev = getDevice();
        // dev.unregisterAPI(DisplayDataChannelAPI.class);
        dev.unregisterAPI(HardwareCursorAPI.class);
        super.stopDevice();
    }
View Full Code Here


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

        new DhcpCommand().execute(args);
    }

    public void execute() throws DeviceNotFoundException, NameNotFoundException, ApiNotFoundException,
        UnknownHostException, NetworkException {
        final Device dev = argDevice.getValue();

        // The DHCP network configuration process will attempt to configure the DNS.  This will only work if
        // the IP address 127.0.0.1 is bound to the loopback network interface.  And if there isn't, JNode's
        // network layer is left in a state that will require a reboot to unjam it (AFAIK). 
        //
        // So, check that loopback is correctly bound ...
        Device loopback = (InitialNaming.lookup(DeviceManager.NAME)).getDevice("loopback");
        NetDeviceAPI api = loopback.getAPI(NetDeviceAPI.class);
        ProtocolAddressInfo info = api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
        if (info == null || !info.contains(InetAddress.getByAddress(new byte[]{127, 0, 0, 1}))) {
            PrintWriter err = getError().getPrintWriter();
            err.format(err_loopback);
            exit(1);
View Full Code Here

                final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
                out.format(fmt_devices, dev.getId(), api.getAddress(), api.getMTU(),
                           api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
            }
        } else {
            final Device dev = argDevice.getValue();
            final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);

            if (!argIPAddress.isSet()) {
                // Print IP address(es) for device
                out.format(fmt_ip, dev.getId(), api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
            } else {
                // Set IP address for device
                final IPv4Address ip = argIPAddress.getValue();
                final IPv4Address mask = argSubnetMask.getValue();
                final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
                cfg.configureDeviceStatic(dev, ip, mask, true);

                // FIXME ... this doesn't show the device's new address because the
                // IPv4 ConfigurationServiceImpl calls processor.apply with the
                // waitUntilReady parameter == false.  (The comment in the code
                // talks about avoiding deadlocks.)
                out.format(fmt_set_ip, dev.getId(), api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
            }
        }
    }
View Full Code Here

                        e.getWhen(), e.getModifiersEx(), e.getKeyCode(), e.getKeyChar());
                    keyboardDriver.dispatchEvent(k);
                }
            };
            screen.addKeyListener(keyListener);
            keyboardDevice = new Device(new Bus((Bus) null) {
            }, "");
            try {
                keyboardDevice.setDriver(keyboardDriver);
                keyboardDriver.startDevice();
            } catch (DriverException x) {
View Full Code Here

        new FBTest().execute(args);
    }

    public void execute() {

        Device dev = ARG_DEVICE.getValue();
        count = ARG_LOOPS.isSet() ? ARG_LOOPS.getValue() : 100;
        tests = ARG_TESTS.isSet() ? ARG_TESTS.getValue() : "lREAQC";

        try {
            if (dev == null) {
                final Collection<Device> devs = DeviceUtils.getDevicesByAPI(FrameBufferAPI.class);
                if (devs.size() == 0) {
                    getError().getPrintWriter().println("No framebuffer devices to test");
                    exit(1);
                }
                dev = new ArrayList<Device>(devs).get(0);
            }

            log.info("Using device " + dev.getId());
            final FrameBufferAPI api = dev.getAPI(FrameBufferAPI.class);
            final FrameBufferConfiguration conf = api.getConfigurations()[0];

            g = api.open(conf);
            this.width = conf.getScreenWidth();
            this.height = conf.getScreenHeight();
View Full Code Here

            pointerDriver = new MyPointerDriver();
            mouseListener = new MouseHandler();
            screen.addMouseListener(mouseListener);
            screen.addMouseMotionListener(mouseListener);
            screen.addMouseWheelListener(mouseListener);
            pointerDevice = new Device(new Bus((Bus) null) {
            }, "");
            try {
                pointerDevice.setDriver(pointerDriver);
                pointerDriver.startDevice();
            } catch (DriverException x) {
View Full Code Here

    public static void main(String[] args) throws Exception {
        new BootpCommand().execute(args);
    }

    public void execute() throws NameNotFoundException, NetworkException {
        final Device dev = argDevice.getValue();
        getOutput().getPrintWriter().format(fmt_config, dev.getId());
        final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
        cfg.configureDeviceBootp(dev, true);
    }
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);
        }
        device.registerAPI(FrameBufferAPI.class, this);
    }
View Full Code Here

    /**
     * @see org.jnode.driver.Driver#stopDevice()
     */
    protected void stopDevice() throws DriverException {
        final Device dev = getDevice();
        dev.unregisterAPI(FrameBufferAPI.class);
    }
View Full Code Here

TOP

Related Classes of org.jnode.driver.Device

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.