Package org.jnode.driver

Examples of org.jnode.driver.DeviceManager


public class VirtualDeviceFactory {
    public static VirtualDevice createDevice(String name) throws DeviceException {
        try {
            final VirtualDevice dev = new VirtualDevice(name);
            dev.setDriver(new VirtualDeviceDriver());
            final DeviceManager dm = DeviceUtils.getDeviceManager();
            dm.register(dev);
            return dev;
        } catch (Exception x) {
            throw new DeviceException(x);
        }
    }
View Full Code Here


    /**
     * @see org.jnode.driver.Driver#startDevice()
     */
    protected final void startDevice() throws DriverException {
        final Device device = getDevice();
        final DeviceManager dm;
        try {
            dm = InitialNaming.lookup(DeviceManager.NAME);
            dm.rename(device, getDevicePrefix(), true);
        } catch (DeviceAlreadyRegisteredException ex) {
            log.error("Cannot rename device", ex);
            throw new DriverException("Cannot rename device", ex);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find DeviceManager", ex);
View Full Code Here

    public FireWireDriver() {
    }

    protected void startDevice() throws DriverException {
        final Device device = getDevice();
        final DeviceManager dm;
        try {
            dm = InitialNaming.lookup(DeviceManager.NAME);
            dm.rename(device, getDevicePrefix(), true);
        } catch (DeviceAlreadyRegisteredException ex) {
            log.error("Cannot rename device", ex);
            throw new DriverException("Cannot rename device", ex);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find DeviceManager", ex);
View Full Code Here

     * Plays a series of notes through the default speaker.
     * Null argument or zero length array plays the standard beep.
     */
    public static void play(Note[] n) {
        try {
            DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
            Device dev = dm.getDevice("speaker0");
            SpeakerAPI s = dev.getAPI(SpeakerAPI.class);
            if (n == null || n.length == 0) {
                s.beep();
            } else {
                s.playNote(n);
View Full Code Here

    public CardBusDriver() {
    }

    protected void startDevice() throws DriverException {
        final Device device = getDevice();
        final DeviceManager dm;
        try {
            dm = InitialNaming.lookup(DeviceManager.NAME);
            dm.rename(device, getDevicePrefix(), true);
        } catch (DeviceAlreadyRegisteredException ex) {
            log.error("Cannot rename device", ex);
            throw new DriverException("Cannot rename device", ex);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find DeviceManager", ex);
View Full Code Here

    public static void main(String[] args) {

        String devId = (args.length > 0) ? args[0] : "eth0";

        try {
            final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
            final Device dev = dm.getDevice(devId);
            final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
            final EthernetAddress mac = (EthernetAddress) api.getAddress();

            SocketBuffer skbuf = new SocketBuffer();
            skbuf.insert(28);
View Full Code Here

                new FileIDEDevice(name, true, true, new File(directory, name), DEFAULT_FILE_SIZE);
        return dev;
    }

    public static void restart(Device device) {
        DeviceManager devMan;
        try {
            devMan = org.jnode.driver.DeviceUtils.getDeviceManager();

            devMan.stop(device);
            devMan.start(device);
        } catch (NameNotFoundException e) {
            log.error(e);
        } catch (DeviceNotFoundException e) {
            log.error(e);
        } catch (DriverException e) {
View Full Code Here

    }

    public static boolean addDevice(AbstractIDEDevice device) {
        boolean success = false;
        try {
            DeviceManager devMan = org.jnode.driver.DeviceUtils.getDeviceManager();
            devMan.register(device);
            success = true;

            // PartitionHelper helper = new PartitionHelper(device);
            // helper.initMbr();
            // helper.write();
View Full Code Here

        return success;
    }

    public static String findUnusedName(String baseName) throws NameNotFoundException {
        DeviceManager devMan = org.jnode.driver.DeviceUtils.getDeviceManager();
        String name = null;
        int i = 0;
        do {
            String newName = baseName + "-" + i;
            try {
                devMan.getDevice(newName);
                i++;
            } catch (DeviceNotFoundException e) {
                name = newName;
            }
        } while (name == null);
View Full Code Here

    public static void addRoute(IPv4Address target, IPv4Address gateway, Device device)
        throws NetworkException {

        if (device == null) {
            // Find the device ourselves
            final DeviceManager dm;
            try {
                dm = InitialNaming.lookup(DeviceManager.NAME);
            } catch (NameNotFoundException ex) {
                throw new NetworkException("Cannot find DeviceManager", ex);
            }
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.