Package org.jnode.driver.bus.usb

Examples of org.jnode.driver.bus.usb.InterfaceDescriptor


        if (dev.getDescriptor().getDeviceClass() != USB_CLASS_PER_INTERFACE) {
            return null;
        }
        final USBConfiguration conf = dev.getConfiguration(0);
        final USBInterface intf = conf.getInterface(0);
        final InterfaceDescriptor descr = intf.getDescriptor();
        if (descr.getInterfaceClass() != USB_CLASS_MASS_STORAGE) {
            return null;
        }
        log.debug("Found mass storage: " + descr);
        switch (descr.getInterfaceSubClass()) {
            case US_SC_RBC:
                //TODO Implement driver.
                log.info("Driver for subclass" + descr.getInterfaceSubClass() + "Not yet implemented");
                return null;
            case US_SC_8020:
                //TODO Implement driver.
                log.info("Driver for subclass" + descr.getInterfaceSubClass() + "Not yet implemented");
                return null;
            case US_SC_QIC:
                //TODO Implement driver.
                log.info("Driver for subclass" + descr.getInterfaceSubClass() + "Not yet implemented");
                return null;
            case US_SC_UFI:
                //TODO Implement driver.
                log.info("Driver for subclass" + descr.getInterfaceSubClass() + "Not yet implemented");
                return null;
            case US_SC_8070:
                //TODO Implement driver.
                log.info("Driver for subclass" + descr.getInterfaceSubClass() + "Not yet implemented");
                return null;
            case US_SC_SCSI:
                return new USBStorageSCSIHostDriver();
            case US_SC_ISD200:
                //TODO Implement driver.
                log.info("Driver for subclass" + descr.getInterfaceSubClass() + "Not yet implemented");
                return null;
            default:
                return null;
        }
    }
View Full Code Here


     * @throws DriverException
     */
    public USBStorageDeviceData(USBDevice device) throws DriverException {
        this.device = device;
        this.usbInterface = this.device.getConfiguration(0).getInterface(0);
        InterfaceDescriptor intf = this.usbInterface.getDescriptor();
        this.maxLun = 0;
        this.protocol = intf.getInterfaceProtocol();
        this.subClass = intf.getInterfaceSubClass();

        switch (this.protocol) {
            case US_PR_CBI:
                log.info("*** Set transport protocol to CONTROL/BULK/INTERRUPT");
                break;
            case US_PR_BULK:
                log.info("*** Set transport protocol to BULK ONLY");
                this.transport = new USBStorageBulkTransport(this);
                //((USBStorageBulkTransport)USBMassStorage.getTransport()).getMaxLun(usbDev);
                break;
            case US_PR_SCM_ATAPI:
                log.info("*** Set transport protocol to SCM ATAPI");
            default:
                throw new DriverException("Transport protocol not implemented.");
        }

        USBEndPoint ep;
        for (int i = 0; i < intf.getNumEndPoints(); i++) {
            ep = this.usbInterface.getEndPoint(i);
            // Is it a bulk endpoint ?
            if ((ep.getDescriptor().getAttributes() & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) {
                // In or Out ?
                if ((ep.getDescriptor().getEndPointAddress() & USB_DIR_IN) == 0) {
View Full Code Here

        final USBDevice dev = (USBDevice) getDevice();
        UsbBtDevice.setUsbDevice(dev);
        final USBConfiguration conf = dev.getConfiguration(0);
        final USBInterface intf = conf.getInterface(0);
        final InterfaceDescriptor iDesc = intf.getDescriptor();

        USBEndPoint bulkInEndpoint[] = new USBEndPoint[8];
        USBEndPoint bulkOutEndpoint[] = new USBEndPoint[8];
        USBEndPoint intrInEndpoint[] = new USBEndPoint[8];

        int num_bulk_in = 0;
        int num_bulk_out = 0;
        int num_bulk_intr = 0;

        USBEndPoint ep = null;

        for (int i = 0; i < iDesc.getNumEndPoints(); i++) {
            ep = intf.getEndPoint(i);
            // Is it a bulk endpoint ?
            if ((ep.getDescriptor().getAttributes() & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) {
                // In or Out ?
                if ((ep.getDescriptor().getEndPointAddress() & USB_DIR_IN) == 0) {
View Full Code Here

            return null;
        }
        final USBDevice dev = (USBDevice) device;
        final USBConfiguration conf = dev.getConfiguration(0);
        final USBInterface intf = conf.getInterface(0);
        final InterfaceDescriptor descr = intf.getDescriptor();
        if (descr.getInterfaceClass() != USB_CLASS_WIRELESS) {
            return null;
        }
        log.debug("Found USB wireless device.");
        if (descr.getInterfaceSubClass() == US_SC_RF) {
            log.debug("Subclass " + descr.getInterfaceSubClass());
            return new UsbBluetoothDriver();
        }
        return null;
    }
View Full Code Here

            final USBDevice dev = (USBDevice) device;
            if (dev.getDescriptor().getDeviceClass() == USB_CLASS_PER_INTERFACE) {

                final USBConfiguration conf = dev.getConfiguration(0);
                final USBInterface intf = conf.getInterface(0);
                final InterfaceDescriptor descr = intf.getDescriptor();

                if (descr.getInterfaceClass() == USB_CLASS_HID) {
                    if (descr.getInterfaceSubClass() == HID_SUBCLASS_BOOT_INTERFACE) {
                        switch (descr.getInterfaceProtocol()) {
                            case HID_PROTOCOL_KEYBOARD:
                                // We found an USB keyboard
                                return new USBKeyboardDriver();
                            case HID_PROTOCOL_MOUSE:
                                // We found an USB mouse
View Full Code Here

TOP

Related Classes of org.jnode.driver.bus.usb.InterfaceDescriptor

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.