Thanks for your time.

Alan Stern wrote:
> You must not have sent a Set-Port-Feature request.  This warning gets
> invoked only when the recipient part of bRequestType is ENDPOINT or
> INTERFACE, and for Set-Port-Feature the recipient is OTHER.
[...]
> You are allowed to send control messages whose recipient is anything other
> than ENDPOINT or INTERFACE, and you are allowed to send those as well if
> the type is VENDOR.

Could you please take a deep breath, Alan?  I think that I am not your
enemy, never.  It would be good if we share the problem and cooperate
together.

Your explanation (what I quoted here) is correct.  But the my
requirement is not only for Set-Port-Feature, but also for
Clear-Port-Feature.

Here is some more explanation to the people who have interest on this
topic.

We need to send a Clear-Port-Feature to turn off the port power, and a
Set-Port-Feature to turn on the port power.  That's my understanding.
(When I connect my hub, the port power is on.)

The answer of the quiz is that when I didn't success with libusb
library, my invocation was with USB_REQ_CLEAR_FEATURE.

Right, in drivers/usb/core/devio.c, there is a function
check_ctrlrecip, and only when requesttype is ENDPOINT or INTERFACE,
it is checked.  Here is a quote of a part of check_ctrlrecip:

        switch (requesttype & USB_RECIP_MASK) {
        case USB_RECIP_ENDPOINT:
                if ((ret = findintfep(ps->dev, index)) >= 0)
                        ret = checkintf(ps, ret);
                break;

        case USB_RECIP_INTERFACE:
                ret = checkintf(ps, index);
                break;
        }

What's USB_RECIP_MASK?  It is defined in include/linux/usb_ch9.h:

#define USB_RECIP_MASK                  0x1f
#define USB_RECIP_DEVICE                0x00
#define USB_RECIP_INTERFACE             0x01
#define USB_RECIP_ENDPOINT              0x02
#define USB_RECIP_OTHER                 0x03

And the values of Clear-Port-Feature and Set-Port-Feature are:

#define USB_REQ_CLEAR_FEATURE           0x01
#define USB_REQ_SET_FEATURE             0x03

Yes, it is OTHER for Set-Port-Feature.  It is INTERFACE for
Clear-Port-Feature.
-- 


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to