• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » StarterWare » StarterWare forum » usb_dev_bulk: remove from "Safely Remove Hardware" list?
Share
StarterWare
  • Forum
Options
  • Subscribe via RSS

Forums

usb_dev_bulk: remove from "Safely Remove Hardware" list?

This question is answered
Jonathan Chen
Posted by Jonathan Chen
on Apr 05 2012 10:36 AM
Intellectual635 points

Using the AM1808 StarterWare usb_dev_bulk example to run the EVM as a generic USB bulk device.

The device shows up in the "Safely Remove Hardware and Eject Media" list in the system tray - this is probably unnecessary for my application..

To my understanding, the "Safely Remove Hardware" list is controlled by Windows system queries to the host-side driver - so when we use Microsoft's WinUSB driver, this is out of our control?

Is there really no way to enable surprise removal in our INF file, in StarterWare, or elsewhere?

Thank you!!
Jonathan

StarterWare am1808 USB usb_dev_bulk
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Ajay
    Posted by Ajay
    on May 03 2012 06:58 AM
    Genius9470 points

    Please provide more detail on your desired application. You might need to write your own example instead of usb_dev_bulk as this uses standard MSC descriptor and so windows PC will show it in system tray.

    Ajay

    If my reply answers your question then please click on the green button "Verify Answer"

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jonathan Chen
    Posted by Jonathan Chen
    on May 03 2012 11:20 AM
    Intellectual635 points

    Dear Ajay:

    Thanks for your reply!

    My application will use basic USB bulk transfers as in usb_dev_bulk, using the WinUSB driver on the PC side.  I do need to set bInterfaceClass = 0xFF (vendor-specific) in my interface descriptor.

    usb_dev_bulk

    • need to install WinUSB driver on PC side (not MSC)
      - does not mount as a drive
    • usbdbulk.c / g_pBulkInterface: USB_CLASS_VEND_SPECIFIC
      - i.e., bInterfaceClass = 0xFF (usblib.h)
    • however, "Stellaris Bulk Device" still appears in the "Safely Remove Hardware" list
      - is there any way to avoid this by changing firmware or the INF file?
      - writing a custom PC driver is infeasible for us..

    Contrast with usb_dev_msc (I am not using this):

    • no driver installation (generic windows mass storage)
    • usbdmsc.c / g_pMSCInterface: USB_CLASS_MASS_STORAGE
      - i.e., bInterfaceClass = 0x08 (usblib.h)

    Sorry about any miscommunication.

    Thanks!
    Jonathan

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ajay
    Posted by Ajay
    on May 04 2012 10:41 AM
    Genius9470 points

    Jonathan,

    Did you try changing the device descriptor data in starterware code. Search where dev_msc descriptor are being defined and do the changed as per you need. important one is bInterfaceClass code in "device descriptor" and "interface descriptor".

    Ajay

    If my reply answers your question then please click on the green button "Verify Answer"

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jonathan Chen
    Posted by Jonathan Chen
    on May 04 2012 15:34 PM
    Intellectual635 points

    Dear Ajay:

    Unfortunately, my application requires and already uses

    • bInterfaceClass = 0xFF
    • WinUSB driver on PC side
    • "Generic Bulk Device" is shown on the "Safely Remove Hardware" list

    Also my code is based on usb_dev_bulk, not usb_dev_msc.  Sorry if I was unclear earlier.

    I suspect the source of the problem is the way the WinUSB driver interacts with Windows' USB stack, and winusb.sys is not enabling surprise removal... What do you think?  I am fairly new to all of this, and I am not very sure about anything..

    Thank you!
    Jonathan

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ajay
    Posted by Ajay
    on May 07 2012 00:20 AM
    Genius9470 points

    Jonathan,

    It all fine that your application uses 0xff code. You need to change the same in descriptor data in starterware firmware also. I mean when starter ware is connected to PC it should tell to windows that its bInterfaceClass code is 0xFF which would require change in starterware code as default bInterfaceClass will be set to as of MSC class.

    Ajay

    If my reply answers your question then please click on the green button "Verify Answer"

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jonathan Chen
    Posted by Jonathan Chen
    on May 07 2012 08:57 AM
    Intellectual635 points

    Dear Ajay:

    Ajay
    default bInterfaceClass will be set to as of MSC class.


    As far as I can tell, this is not correct. 

    By "application", I was referring to both my PC-side and firmware-side custom code; sorry about any confusion.

    I did not want to post large chunks of default StarterWare code we should both already have, but I feel this information is not being communicated properly.  Please see the following yellow highlighted library code, copy/pasted unmodified from default StarterWare code for the usb_dev_bulk example:


    // AM1808_StarterWare_1_00_03_03/usblib/device/usbdbulk.c

    //...
    #include "usblib.h"
    //...

    //*****************************************************************************
    //
    // Device Descriptor.  This is stored in RAM to allow several fields to be
    // changed at runtime based on the client's requirements.
    //
    //*****************************************************************************
    unsigned char g_pBulkDeviceDescriptor[] =

    {
        18,                         // Size of this structure.
        USB_DTYPE_DEVICE,           // Type of this structure.
        USBShort(0x110),            // USB version 1.1 (if we say 2.0, hosts assume
                                    // high-speed - see USB 2.0 spec 9.2.6.6)
        USB_CLASS_VEND_SPECIFIC,    // USB Device Class
        0,                          // USB Device Sub-class
        0,                          // USB Device protocol
        64,                         // Maximum packet size for default pipe.
        USBShort(0),                // Vendor ID (VID).
        USBShort(0),                // Product ID (PID).
        USBShort(0x100),            // Device Version BCD.
        1,                          // Manufacturer string identifier.
        2,                          // Product string identifier.
        3,                          // Product serial number.
        1                           // Number of configurations.
    };

    // ...

    //*****************************************************************************
    //
    // The remainder of the configuration descriptor is stored in flash since we
    // don't need to modify anything in it at runtime.
    //
    //*****************************************************************************
    const unsigned char g_pBulkInterface[] =
    {
        //
        // Vendor-specific Interface Descriptor.
        //
        9,                          // Size of the interface descriptor.
        USB_DTYPE_INTERFACE,        // Type of this descriptor.
        0,                          // The index for this interface.
        0,                          // The alternate setting for this interface.
        2,                          // The number of endpoints used by this
                                    // interface.
        USB_CLASS_VEND_SPECIFIC,    // The interface class
        0,                          // The interface sub-class.
        0,                          // The interface protocol for the sub-class
                                    // specified above.
        4,                          // The string index for this interface.

        //
        // Endpoint Descriptor
        //
        7,                               // The size of the endpoint descriptor.
        USB_DTYPE_ENDPOINT,              // Descriptor type is an endpoint.
        USB_EP_DESC_IN | USB_EP_TO_INDEX(DATA_IN_ENDPOINT),
        USB_EP_ATTR_BULK,                // Endpoint is a bulk endpoint.
        USBShort(DATA_IN_EP_MAX_SIZE),   // The maximum packet size.
        0,                               // The polling interval for this endpoint.

        //
        // Endpoint Descriptor
        //
        7,                               // The size of the endpoint descriptor.
        USB_DTYPE_ENDPOINT,              // Descriptor type is an endpoint.
        USB_EP_DESC_OUT | USB_EP_TO_INDEX(DATA_OUT_ENDPOINT),
        USB_EP_ATTR_BULK,                // Endpoint is a bulk endpoint.
        USBShort(DATA_OUT_EP_MAX_SIZE),  // The maximum packet size.
        0,                               // The polling interval for this endpoint.
    };


    // AM1808_StarterWare_1_00_03_03/usblib/include/usblib.h for reference

    // ...

    //*****************************************************************************
    //
    // USB Device Class codes used in the tDeviceDescriptor.bDeviceClass field.
    // Definitions for the bDeviceSubClass and bDeviceProtocol fields are device
    // specific and can be found in the appropriate device class header files.
    //
    //*****************************************************************************
    #define USB_CLASS_DEVICE        0x00
    #define USB_CLASS_AUDIO         0x01
    #define USB_CLASS_CDC           0x02
    #define USB_CLASS_HID           0x03
    #define USB_CLASS_PHYSICAL      0x05
    #define USB_CLASS_IMAGE         0x06
    #define USB_CLASS_PRINTER       0x07
    #define USB_CLASS_MASS_STORAGE  0x08
    #define USB_CLASS_HUB           0x09
    #define USB_CLASS_CDC_DATA      0x0a
    #define USB_CLASS_SMART_CARD    0x0b
    #define USB_CLASS_SECURITY      0x0d
    #define USB_CLASS_VIDEO         0x0e
    #define USB_CLASS_HEALTHCARE    0x0f
    #define USB_CLASS_DIAG_DEVICE   0xdc
    #define USB_CLASS_WIRELESS      0xe0
    #define USB_CLASS_MISC          0xef
    #define USB_CLASS_APP_SPECIFIC  0xfe
    #define USB_CLASS_VEND_SPECIFIC 0xff
    #define USB_CLASS_EVENTS        0xffffffff

    • This is all default StarterWare firmware code,
    • Using this default StarterWare firmware code, the EVM board is listed under the "Safely Remove Hardware" list. This is the issue I reported in my original post.
    • This is not the Mass Storage Class example (usb_dev_msc). The usb_dev_bulk firmware example that I use is described here in the StarterWare wiki.
      - usb_dev_bulk does not use MSC code.
      - usb_dev_bulk does not mount as a Removable Drive.
    • The usb_dev_bulk example uses usbdbulk.c
      - it does not use usbdmsc.c

    Please let me know if I am not understanding something correctly.

    Sincerely,
    Jonathan



    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ajay
    Posted by Ajay
    on May 07 2012 23:49 PM
    Genius9470 points

    Jonathan,

    I am sorry to create confusion, I am not directly working and have code for starterware. Now I understand the issue on why PC is showing the device in "Safely Remove Hardware list" when the device is vendor specific.

    I am not sure on how is this affecting you work ?  I believe you can still go ahead and communicate to starterware devcie using your custom application on PC. I can see in my wondows 7 PC even non MSC devices getting listed in "Safely Remove list"/

    Ajay

    If my reply answers your question then please click on the green button "Verify Answer"

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jonathan Chen
    Posted by Jonathan Chen
    on May 08 2012 08:38 AM
    Intellectual635 points

    Dear Ajay:

    You are correct, the PC and StarterWare device can still communicate correctly.

    Our application/firmware does not require Safe Removal (i.e., allows surprise removal), so it is not necessary to list our device under "Safely Remove Hardware".

    If we could remove our device from the "Safely Remove Hardware" list, the overall experience would be that much less confusing experience for the end user.

    This is a minor issue.  However, CDC devices (USB/serial converters) are not shown in the "Safely Remove Hardware" list, so wanted to know whether it would be possible by changing one of the following:

    • device firmware
    • application software
    • Windows INF file
    • Windows driver (winusb.sys)

    Or is "Safely Remove Hardware" specified unconditionally by the USB standard for Vendor Specific devices?  We are able to modify everything except for winusb.sys.

    Thank you!
    Jonathan

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ajay
    Posted by Ajay
    on May 09 2012 23:34 PM
    Genius9470 points

    I don't have answer to this. May be you can post this in Microsoft's support forum.

    Thanks,

    Ajay

    If my reply answers your question then please click on the green button "Verify Answer"

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jonathan Chen
    Posted by Jonathan Chen
    on May 10 2012 10:36 AM
    Verified Answer
    Verified by Jonathan Chen
    Intellectual635 points

    Thank you for your patience, Ajay.

    From MSDN Forums:

    Pavel A on MSDN Forums

    See this thread. Unless it is fixed in the current WinUsb... it still does not work.

    -- pa

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ajay
    Posted by Ajay
    on May 11 2012 00:50 AM
    Genius9470 points

    good to see that we now know where the issue it.

    Ajay

    If my reply answers your question then please click on the green button "Verify Answer"

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use