Package org.jnode.driver.bus.usb

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


            cbw.setLength((byte) scsiCmd.length);
            cbw.setCdb(scsiCmd);
            log.debug(cbw.toString());
            // Sent CBW to device
            USBDataPipe outPipe = ((USBDataPipe) storageDeviceData.getBulkOutEndPoint().getPipe());
            USBRequest req = outPipe.createRequest(cbw);
            if (timeout <= 0) {
                outPipe.asyncSubmit(req);
            } else {
                outPipe.syncSubmit(req, timeout);
            }
            //
            CSW csw = new CSW();
            csw.setSignature(US_BULK_CS_SIGN);
            USBDataPipe inPipe = ((USBDataPipe) storageDeviceData.getBulkInEndPoint().getPipe());
            USBRequest resp = inPipe.createRequest(csw);
            if (timeout <= 0) {
                inPipe.asyncSubmit(resp);
            } else {
                inPipe.syncSubmit(resp, timeout);
            }
View Full Code Here


    /**
     * Bulk-Only mass storage reset.
     */
    public void reset() throws USBException {
        final USBControlPipe pipe = storageDeviceData.getDevice().getDefaultControlPipe();
        final USBRequest req = pipe.createRequest(new SetupPacket(USB_DIR_OUT
            | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0xFF, 0, 0, 0), null);
        pipe.syncSubmit(req, GET_TIMEOUT);
    }
View Full Code Here

     */
    public void getMaxLun(USBDevice usbDev) throws USBException {
        log.info("*** Get max lun ***");
        final USBControlPipe pipe = usbDev.getDefaultControlPipe();
        final USBPacket packet = new USBPacket(1);
        final USBRequest req = pipe.createRequest(new SetupPacket(USB_DIR_IN
            | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0xFE, 0, 0, 1), packet);
        pipe.syncSubmit(req, GET_TIMEOUT);
        log.debug("*** Request data     : " + req.toString());
        log.debug("*** Request status   : 0x" + NumberUtils.hex(req.getStatus(), 4));
        if (req.getStatus() == USBREQ_ST_COMPLETED) {
            storageDeviceData.setMaxLun(packet.getData()[0]);
        } else if (req.getStatus() == USBREQ_ST_STALLED) {
            storageDeviceData.setMaxLun((byte) 0);
        } else {
            throw new USBException("Request status   : 0x" + NumberUtils.hex(req.getStatus(), 4));
        }
    }
View Full Code Here

        try {
            intPipe.open();
            intData =
                    new USBPacket(UsbBtDevice.getIntrInEndpoint().getDescriptor()
                            .getMaxPacketSize());
            final USBRequest req = intPipe.createRequest(intData);
            intPipe.asyncSubmit(req);
        } catch (USBException e1) {
            log.debug("*** USB exception occurs.");
            e1.printStackTrace();
        }
View Full Code Here

        this.intrInEndpoint = intrInEndpoint;
    }

    public void testCommand() throws USBException {
        final USBControlPipe pipe = usbDevice.getDefaultControlPipe();
        final USBRequest req = pipe.createRequest(
                new SetupPacket(USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_DEVICE, 0x20, 0, 0, 0), null);
        pipe.syncSubmit(req, GET_TIMEOUT);
    }
View Full Code Here

            old = new byte[8];
            intData = new USBPacket(ep.getDescriptor().getMaxPacketSize());
            intPipe = (USBDataPipe) ep.getPipe();
            intPipe.addListener(this);
            intPipe.open();
            final USBRequest req = intPipe.createRequest(intData);
            intPipe.asyncSubmit(req);

            // Configure the default keyboard layout and register the KeyboardAPI
            KeyboardLayoutManager mgr = InitialNaming.lookup(KeyboardLayoutManager.NAME);
            apiAdapter.setKbInterpreter(mgr.createDefaultKeyboardInterpreter());
View Full Code Here

            // Create the interrupt request
            intPipe = (USBDataPipe) ep.getPipe();
            intPipe.addListener(this);
            intPipe.open();
            intData = new USBPacket(ep.getDescriptor().getMaxPacketSize());
            final USBRequest req = intPipe.createRequest(intData);
            intPipe.asyncSubmit(req);

            // Register the PointerAPI
            dev.registerAPI(PointerAPI.class, apiAdapter);
        } catch (USBException ex) {
View Full Code Here

     * Read the status of a given port into the given structure.
     */
    private void readPortStatus(int port, PortStatus data) throws USBException {
        testPort(port);
        final USBControlPipe pipe = dev.getDefaultControlPipe();
        final USBRequest req =
            pipe.createRequest(new SetupPacket(USB_DIR_IN | USB_RT_PORT, USB_REQ_GET_STATUS, 0, port + 1, 4), data);
        pipe.syncSubmit(req, GET_TIMEOUT);
    }
View Full Code Here

TOP

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

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.