FTDI Community

General Category => General Discussion => Topic started by: Yvonne on January 13, 2023, 09:52:14 AM

Title: Receive error code of "0x14" when trying to get report id from setup packet
Post by: Yvonne on January 13, 2023, 09:52:14 AM
Hello,

I am using VNC2 as usb host controller transmitting data packets scan by barcode scanner.   
I give value 0x06 for bRequest in the SETUP TRANSFER code as shown in follows, however I get error code 0x14 on my IDE as shown in the attached figure. I could not find what 0x14 meant in the USBHost.h library (the values of USBHOST_STATUS are from -1~16). Therefore, what does the error code 0x14 mean? Any suggestion to fix this problem?

Also, I have two barcode scanners. When I use them to scan the barcode and I receive data in 8 bytes for one and 9 bytes for another. I looked up the data in wireshark on windows, the one more bytes one barcode scanner had is the report id. Therefore, I tried to get the "report id" infromation from the setup data. I tried to give 0x06 (GET_DESCRIPTOR) for bRequest and 0x07 (SET_DESCRIPTOR) for bRequest both, but all of the two command values got into error messgae when running code " vos_dev_ioctl(hUSBHOST_1, &hc_iocb)". One of the error message is 0x14.

Alternatively, I tried to attach the hid driver for usb host but cannnot get the correct report id information as shwon in the first data byte of the 9-bytes-based barcode scanner. My goal is that I want to get the correct report id information, or remover it, or set it into zero to let the two barcode scanners receive the same data byte length. Are there any configs I miss or made wrong? Or any suggestions are appreciated in advanced!

The following is part of my code:
////// test 1 /////////   
    desc_dev.bmRequestType = USB_BMREQUESTTYPE_HOST_TO_DEV | USB_BMREQUESTTYPE_CLASS | USB_BMREQUESTTYPE_DEVICE;
    desc_dev.bRequest = 0x06;
         
    hc_iocb.ioctl_code = VOS_IOCTL_USBHOST_DEVICE_SETUP_TRANSFER;
    hc_iocb.handle.ep = epCtrl;
    hc_iocb.set = &desc_dev;

    status = vos_dev_ioctl(hUSBHOST_1, &hc_iocb);
         
    if (status != USBHOST_OK) {
        break;
    }

    hid_reportid2 = desc_dev.wValue & 0xff;
///////////////////////
/////// test 2 /////////
    desc_dev.bmRequestType = USB_BMREQUESTTYPE_HOST_TO_DEV | USB_BMREQUESTTYPE_CLASS | USB_BMREQUESTTYPE_DEVICE;
    desc_dev.bRequest = 0x07;
    desc_dev.wValue = 0x0200;
            
    hc_iocb.ioctl_code = VOS_IOCTL_USBHOST_DEVICE_SETUP_TRANSFER;
    hc_iocb.handle.ep = epCtrl;
    hc_iocb.set = &desc_dev;

    status = vos_dev_ioctl(hUSBHOST_1, &hc_iocb);
    if (status != USBHOST_OK) {
        break;
    }

    hid_reportid3 = desc_dev.wValue & 0xff;
///////////////////////

Thank you so much for your kind help!

Yvonne
Title: Re: Receive error code of "0x14" when trying to get report id from setup packet
Post by: FTDI Community on January 13, 2023, 03:03:39 PM
Hi,

You can reference the example found in C:\Users\Username\Documents\FTDI\Firmware\Samples\V2.0.2-SP2\USBHost\USBHostHID2. This example has been tested with a barcode scanner.

You should also have a look at Vinculum II User Guide (https://ftdichip.com/wp-content/uploads/2020/08/AN_151_Vinculum-II_User_Guide.pdf). This details the full VNC2 API. See page 270 for the return codes.

Best Regards

FTDI Community
Title: Re: Receive error code of "0x14" when trying to get report id from setup packet
Post by: Yvonne on January 16, 2023, 10:02:27 AM
Hello,

Thank you for your kind reply. I have had read the return code again in the VNC2 User Guide document.

However, as I need the report id information from hid device in my project, could you give me the instruction that which exmaple code can get the report id info.?

Than you so much!

Yvonne
Title: Re: Receive error code of "0x14" when trying to get report id from setup packet
Post by: FTDI Community on January 16, 2023, 03:23:30 PM
Hi Yvonne,

The only examples can be found here:

C:\Users\Username\Documents\FTDI\Firmware\Samples\V2.0.2-SP2

I'm not sure if there is a HID report ID example, but if there is it will be in that directory. You can also create your own firmware for this purpose. See Vinculum II User Guide (https://ftdichip.com/wp-content/uploads/2020/08/AN_151_Vinculum-II_User_Guide.pdf).

Best Regards
FTDI Community
Title: Re: Receive error code of "0x14" when trying to get report id from setup packet
Post by: Yvonne on June 02, 2023, 06:53:53 AM
Hello,

Thank you so much for your kind reply and information.

I modified the example codes based on folders "USBHostHID" and "USBHostHID2" from the path you provided to do my project.

Thank you so much!
Yvonne