AnsweredAssumed Answered

stm32f2 libusb and custom usb request - something strange

Question asked by komkov.pavel on Nov 18, 2012
Latest reply on Nov 21, 2012 by komkov.pavel
Tried to implement custom device control over vendor specific requests. 
Usb device library v1.1.0, usb otg library v2.1.0 and stm32f207 on device side, 
libusb 1.011, debian gnu linux on host side.
 For experiment i modify custom hid example - added some code to USBD_HID_Setup() func. 
On host side i'm just use example from libusb package - hid-custom-irq commandline. device is recognized, handle open successfully. But something wrong - when i issue set-led on all is ok - no errors from libusb and led is on and when i issue set-led off - led is still turn on and libusb shows time-out.
code on mcu:
    switch (req->bRequest)
            case CUSTOM_MC_JOB:
            case CUSTOM_RQ_SET_STATUS:
                //GPIOC->BSRRL |= ((uint16_t)ctmp&0x0f)<<6;
                //GPIOC->BSRRH |= ((~ctmp)&0x0f)<<6;
code on PC (unmodified example except changed vid&pid and so on)
}else if((isOn = (strcasecmp(argv[1], "on") == 0)) || strcasecmp(argv[1], "off") == 0){
        cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, CUSTOM_RQ_SET_STATUS, isOn, 0, buffer, 0, 5000);
if(cnt < 0){
            fprintf(stderr, "USB error: %s\n", usb_strerror());
experiment a bit with wValue on pc side - it seems that if i send somethig else than 1 - got same error.
anybody experience anything similar?