View topic - Turn On/Off USB ports in QNX 6.5SP1

Turn On/Off USB ports in QNX 6.5SP1

For discussion of realtime and/or embedded programming.

Turn On/Off USB ports in QNX 6.5SP1

Postby sheran.vaz » Mon Jul 09, 2018 7:42 pm

Any sample codes available for turning ON/Off USB ports on a smart hub? (in QNX 6.5SP1)
sheran.vaz
Senior Member
 
Posts: 101
Joined: Mon May 11, 2009 9:17 am

Re: Turn On/Off USB ports in QNX 6.5SP1

Postby nico04 » Tue Jul 10, 2018 6:10 am

With your version of QNX, do you have "/pps/qnx/device/usb_ctrl" in your root path ?
(The USB stack must be running).
nico04
Senior Member
 
Posts: 114
Joined: Wed Sep 29, 2010 9:59 am
Location: France

Re: Turn On/Off USB ports in QNX 6.5SP1

Postby nico04 » Tue Jul 10, 2018 6:14 am

I think usblauncher must be running too.
nico04
Senior Member
 
Posts: 114
Joined: Wed Sep 29, 2010 9:59 am
Location: France

Re: Turn On/Off USB ports in QNX 6.5SP1

Postby sheran.vaz » Tue Jul 10, 2018 5:10 pm

Can it be toggled using issuing usbd_feature() to the smart hub.

My target is not based out of pps service
sheran.vaz
Senior Member
 
Posts: 101
Joined: Mon May 11, 2009 9:17 am

Re: Turn On/Off USB ports in QNX 6.5SP1

Postby nico04 » Wed Jul 11, 2018 6:03 am

Yes, this is possible but it's quite complex.
nico04
Senior Member
 
Posts: 114
Joined: Wed Sep 29, 2010 9:59 am
Location: France

Re: Turn On/Off USB ports in QNX 6.5SP1

Postby sheran.vaz » Wed Jul 11, 2018 9:40 pm

Can you elaborate?


Thanks!
sheran.vaz
Senior Member
 
Posts: 101
Joined: Mon May 11, 2009 9:17 am

Re: Turn On/Off USB ports in QNX 6.5SP1

Postby nico04 » Fri Jul 13, 2018 6:56 am

With PPS system, the command to turn USB ports ON/OFF is just one line.

Without PPS, you have to create your own USB port manager.

You can find the USB DDK documentation here : http://www.qnx.com/developers/docs/6.5. ... b/api.html

I can't provide you with the code I have but here is an abstract of things you have to do :
Code: Select all
- usbd_connect()             using USBD_CONNECT_WILDCARD for all usbd_device_ident_t structure fields (unless you know the exact device ?)
- for all 64 possible devices :
    - usbd_attach()
    - if success
        - usbd_hub_descriptor()
        - if success
            - usbd_device_extra()
            - if success
                - set_port_feature(port, feature) or clear_port_feature(port, feature)  // ON or OFF (feature = USB_HUB_FEATURE_PORT_POWER)
        - usbd_detach()

set_port_feature() :
- usbd_alloc_urb()
- usbd_setup_vendor()
    - Flags        = URB_DIR_OUT;
    - bRequest     = USB_SET_FEATURE;
    - request_type = 0x23;
        usbd_setup_vendor(urb,                  // An opaque handle (from usbd_alloc_urb()).
                          Flags,                // URB_DIR_OUT—specify outgoing (PC-to-device) transfer.
                          bRequest,             // A device-specific request.
                          request_type,         // The type of request
                          Feature,              // wValue  -> This varies, depending on the request.
                          Port,                 // wIndex  -> This varies, depending on the request.
                          NULL,                 // Data    -> The address for the start of the transfer.
                          0);                   // wLength -> The length (in bytes) of the data transfer.
- usbd_io()
- usbd_free_urb()

clear_port_feature() :
- usbd_alloc_urb()
- usbd_setup_vendor()
    - Flags        = URB_DIR_OUT;
    - bRequest     = USB_CLEAR_FEATURE;
    - request_type = 0x23;
        usbd_setup_vendor(urb,                  // An opaque handle (from usbd_alloc_urb()).
                          Flags,                // URB_DIR_OUT—specify outgoing (PC-to-device) transfer.
                          bRequest,             // A device-specific request.
                          request_type,         // The type of request
                          Feature,              // wValue  -> This varies, depending on the request
                          Port,                 // wIndex  -> This varies, depending on the request
                          NULL,                 // Data    -> The address for the start of the transfer
                          0);                   // wLength -> The length (in bytes) of the data transfer.
- usbd_io()
- usbd_free_urb()
nico04
Senior Member
 
Posts: 114
Joined: Wed Sep 29, 2010 9:59 am
Location: France


Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 5 guests