• AVR Freaks

HID device - switching configurations

Author
skinny_c
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2011/02/08 03:17:28
  • Location: 0
  • Status: offline
2011/02/08 03:24:25 (permalink)
0

HID device - switching configurations

Hi,
 
Can someone please clarify the following for me:
 
I have a USB HID device. It has two configurations which are identical except that one has a power requirement set to 100mA and the other to 500mA.
 
I need the device to be switched to the 500mA configuration if the USB port it’s connected to can supply 500mA.
 
Now, what I’m confused about is:
 
1) Does the HID driver in host PC do this automatically? That is, does it read both the configurations in the device at enumeration time and then tell the device to switch to 500mA if it knows the port can supply 500mA?
 
2) Or, does the application running on the PC that wants to use the HID device have to send a “set configuration” command to the device?
 
I'm hoping that I don't have to write a driver in order to do this as I want to keep the device as a HID as that's what it is.
 
Regards,
 
Chris
 
#1

4 Replies Related Threads

    friesen
    Super Member
    • Total Posts : 2054
    • Reward points : 0
    • Joined: 2008/05/08 05:23:35
    • Location: Indiana, USA
    • Status: offline
    Re:HID device - switching configurations 2011/02/08 06:11:16 (permalink)
    0
    It is all in the device firmware.  The HID driver does nothing with enumeration.  You'll probably need two sets of descriptors to do this.  First try the 500ma set, if enumeration hits a snag, go for the second. 

    Erik Friesen
    #2
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:HID device - switching configurations 2011/02/08 13:08:34 (permalink)
    0

    Here are similar discussions,
    http://www.microchip.com/forums/m404231.aspx
    http://www.microchip.com/forums/m375994.aspx

    IMHO, the effort to implement swapped configurations is unrewarded.
    In most cases, single config of 500 mA will do. 

    The reasons are,
    1) The current draw is limited to 100mA, just when your device is connected to a bus-powered hub.
    2) Many hubs on the market always report its status in self-powered, even when it is actually in bus-powered.

    500 mA config is not enumerated when the bus-powered hub reports its status correctly.
    OS puts a warning dialog for insufficient power supply.
    Therefore, you should have a warning on the manual, "When you see power supply warning, connect this device directly to the PC USB port, or over a self-powered hub". Smile

    Rather, you had better to have a VBUS voltage monitor, and a power-down circuit on your device.

    Tsuneo
    #3
    skinny_c
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2011/02/08 03:17:28
    • Location: 0
    • Status: offline
    Re:HID device - switching configurations 2011/02/09 02:45:09 (permalink)
    0
    Hi Tsuneo,

    Thanks for the reply. I had read one of the previous posts (http://www.microchip.com/forums/m404231.aspx) and that's what lead me to ask for clarification. It is, as I feared, that the PC (Windows) does not bother with anything other than the first config.

    Up until now we have been doing as you suggested and that is just have a single config with a 500mA power requirement. This seems to work just fine, but we were trying to obey the rules and handle ports that can only deliver 100mA.

    Apple do the sensible thing - they read the configurations and automatically select the appropriate config for the port power capability.

    So, if we have a device with a single config with 500mA, then a PC (Windows) will not enumerate it if can only supply 100mA?

    Cheers,

    Chris


    #4
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:HID device - switching configurations 2011/02/09 15:00:10 (permalink)
    0
    Apple do the sensible thing - they read the configurations and automatically select the appropriate config for the port power capability.

    Apple has absolute requirement, because Apple keyboard has bus-powered hub port(s).
    For Windows, Apple has developed a custom device driver for this purpose.

    So, if we have a device with a single config with 500mA, then a PC (Windows) will not enumerate it if can only supply 100mA?

    See above post.

    Do you really have absolute requirement of this feature at any cost?
    Why not make the user swap the USB port for your device?

    Tsuneo
    #5
    Jump to:
    © 2019 APG vNext Commercial Version 4.5