Examples of DeviceManager


Examples of org.jnode.driver.DeviceManager

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

Examples of org.jnode.driver.DeviceManager

    }

    public SCSITest(String[] args) throws ApiNotFoundException,
        NameNotFoundException, DeviceNotFoundException {
        processArgs(args);
        final DeviceManager dm = InitialNaming
            .lookup(DeviceManager.NAME);
        final Device dev = dm.getDevice(name);
        api = dev.getAPI(SCSIDeviceAPI.class);
    }
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    }

    public static RamDiskDevice createRamDisk(int size) {
        RamDiskDevice dev = null;
        try {
            final DeviceManager dm = InitialNaming
                .lookup(DeviceManager.NAME);
            dev = new RamDiskDevice(null, "dummy", size);
            dev.setDriver(new RamDiskDriver(null));
            dm.register(dev);
        } catch (NameNotFoundException e) {
            log.error(e);
        } catch (DeviceAlreadyRegisteredException e) {
            log.error(e);
        } catch (DriverException e) {
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    private static final Logger log = Logger.getLogger(FloppyTest.class);

    public static void main(String[] args) {

        try {
            final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
            final Device fd0 = dm.getDevice("fd0");
            final BlockDeviceAPI api = fd0.getAPI(BlockDeviceAPI.class);
            try {

                final ByteBuffer buf = ByteBuffer.allocate(512);
                api.read(0, buf);
View Full Code Here

Examples of org.jnode.driver.DeviceManager

* @author gbin
*/
public class LowLevelIoTest {

    public static void main(String[] args) {
        DeviceManager dm;
        try {
            dm = InitialNaming.lookup(DeviceManager.NAME);

            IDEDevice current = (IDEDevice) dm.getDevice(args[0]);
            BlockDeviceAPI api = current.getAPI(BlockDeviceAPI.class);

            int size = (int) (Math.random() * 5 /*256*/) * 512;
            int offset = (int) (Math.random() * 10000) * 512;
            System.out.println("Create Random Buffer");
View Full Code Here

Examples of org.jnode.driver.DeviceManager

public class IDETest {

    public static void main(String[] args)
        throws NamingException, ApiNotFoundException, IOException, DeviceNotFoundException {

        final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
        final String name = (args.length > 0) ? args[0] : "hda";

        IDEDevice dev = (IDEDevice) dm.getDevice(name);
        IDEDeviceAPI<?> api = dev.getAPI(IDEDeviceAPI.class);
        IDEDriveDescriptor descr = dev.getDescriptor();

        System.out.println("LBA support   : " + descr.supportsLBA());
        System.out.println("DMA support   : " + descr.supportsDMA());
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    @Override
    protected void startDevice() throws DriverException {
        final Device dev = getDevice();
        // Rename the device
        try {
            final DeviceManager dm = dev.getManager();
            synchronized (dm) {
                dm.rename(dev, "sg", true);
            }
        } catch (DeviceAlreadyRegisteredException ex) {
            throw new DriverException(ex);
        }
View Full Code Here

Examples of org.jnode.driver.DeviceManager

        maxSector = descr.getSectorsAddressable();

        // Look for partitions
        try {
            // Find the devicemanager
            DeviceManager devMan = InitialNaming.lookup(DeviceManager.NAME);
            // Read the bootsector
            final byte[] bs1 = new byte[SECTOR_SIZE];
            read(0, ByteBuffer.wrap(bs1));

            // Read the bootsector twice, since the first read seems to fail.
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    protected void stopDevice() throws DriverException {
        final IDEDevice dev = (IDEDevice) getDevice();
        // find mounted partitions on this device and unregister them !
        try {
            DeviceManager devMan = InitialNaming.lookup(DeviceManager.NAME);
            Collection<Device> devices = devMan.getDevices();
            final ArrayList<IDEDiskPartitionDevice> toStop = new ArrayList<IDEDiskPartitionDevice>();

            for (Device device : devices) {
                if (device instanceof IDEDiskPartitionDevice) {
                    IDEDiskPartitionDevice partition = (IDEDiskPartitionDevice) device;
                    if (partition.getParent() == dev) {
                        toStop.add(partition);
                    }
                }

            }

            for (IDEDiskPartitionDevice partition : toStop) {
                devMan.unregister(partition);
            }
        } catch (NameNotFoundException e) {
            throw new DriverException("Problem while stopping this IDE device", e);
        }
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    @Override
    protected void stopPlugin() throws PluginException {
        log.info("stop RAMFS");
        try {
            FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
            final DeviceManager dm = DeviceUtils.getDeviceManager();
            VirtualDevice dev = (VirtualDevice) dm.getDevice(RAMFileSystemType.VIRTUAL_DEVICE_NAME);
            fSS.unregisterFileSystem(dev);
            log.info("RAMFS unmounted");
            dm.unregister(dev);
            log.info("RAMFS unregistered");
        } catch (NameNotFoundException e) {
            log.error("filsystemservice / filesystemtype not found");
        } catch (DeviceNotFoundException ex) {
            log.info("no ramfs present");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.