Package org.jnode.driver.bus.usb

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


    /**
     * 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) {
View Full Code Here

    }

    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

     */
    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

        super(setupPacket, dataPacket);
    }

    public void createTDs(UHCIPipe pipe)
        throws USBException {
        final SetupPacket setupPacket = getSetupPacket();

        // The setup TD
        setupTD = pipe.createTD(USB_PID_SETUP, true, setupPacket.getData(), 0, setupPacket.getSize(), false);
        //log.debug("setupTD: " + setupTD + ", ls=" + ls);

        // Add the data TD's
        final USBPacket dataPacket = getDataPacket();
        final int transferLength = setupPacket.getLength();
        int length = transferLength;
        int offset = 0;
        final int dataPid = (setupPacket.isDirIn() ? USB_PID_IN : USB_PID_OUT);
        boolean dataToggle = false; // Start with DATA1
        final int maxPacketSize = pipe.getMaxPacketSize();
        if (maxPacketSize <= 0) {
            throw new USBException("Invalid maximum packet size " + maxPacketSize);
        }
        while (length > 0) {

            // Create the TD for this part of the data packet
            final TransferDescriptor dataTD;
            final int curlen = Math.min(length, maxPacketSize);
            dataTD = pipe.createTD(dataPid, dataToggle, dataPacket.getData(), offset, curlen, false);
            // Add the TD to the list
            setupTD.append(dataTD, false);

            // Update fields
            dataToggle = !dataToggle;
            length -= curlen;
            offset += curlen;
        }

        // Add final control packet
        final TransferDescriptor statusTD;
        final int statusPid = ((setupPacket.isDirOut() || (transferLength == 0)) ? USB_PID_IN : USB_PID_OUT);
        statusTD = pipe.createTD(statusPid, false, null, 0, 0, true);
        // Append theTD to the list
        setupTD.append(statusTD, false);
    }
View Full Code Here

TOP

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

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.