This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/PROCESSOR-SDK-DRA7X: Smartphone connected via USB is detected as a camera device

Part Number: PROCESSOR-SDK-DRA7X

Tool/software: Linux

Hi,

I am trying to write a custom USB driver which works with smartphones connected to dra7xx evm over usb. For this driver to function, all of the configuration descriptors (or atleast the vendor specific descriptor) needs to be passed to this driver. However, on connecting the smartphone, only the active configuration is passed to the custom driver. That active configuration is always of a camera device. I made some build time changes in the kernel build by following : http://processors.wiki.ti.com/index.php/Linux_Core_DWC3_User%27s_Guide 

A lead will be helpful on how to get the active configuration as vendor specific configuration, or to get all the configuration of the device.

Platform : Jacinto6-evm.

The driver functioning was tried using the linux shipped with VISION SDK 2.10 and 3.02. The outcome was same.

  • Hello,

    Can you clarify what custom USB driver you are implementing? What is the end goal?

    Thanks.
  • The end goal is to detect an apple device and perform the USB role switch.
  • Hi,

    We suggest to check out the libusb guide: http://libusb.sourceforge.net/api-1.0/group__dev.html

    If the device (interface) is in use by a kernel driver, it will have to be first detached from it by using libusb_detach_kernel_driver(). To check you could first use libusb_kernel_driver_active().

    (NOTE: you might have to run the application as root though)

    To set & get configuration, the app can use the libusb_set_configuration() & libusb_get_configuration().

    Similarly, to set alternate interface, the app can call libusb_set_interface_alt_setting().

    To claim an an interface: libusb_claim_interface() & libusb_release_interface().

    Hope you are able to get your use-case realized with above details.

    Thanks.

  • Hi Praveen,

    Thanks for your input. I tried what you suggested and was able to get an application listing a device completely. However, I am trying to write a loadable kernel object and I cannot link it to a dynamic library. Did you mean I have to get a static library for libusb and package it along with the driver? If not, how else can this be done?

    Also, please not that for my use case, I need to get a notification/probe from the system whenever a new USB device is connected. This is the intention of having a kernel object. Can you please suggest what shall be done to get the same?

  • Hello,

    Thank you for your follow up questions.   These question deal with custom use-case, which is not specific to the TI platform, so recommend looking online for additional resources or example code.

    There are mainly 2 ways to implement your use-case. As mentioned in previously reply, one way is to implement at user level application making use of the libusb library. Another way, as you are suggesting is to use the kernel level object and directly interacting the USB low-level drivers. Suggest you to experiment as needed. Please note that there will be limited support from us since your use-case is not a direct feature that is supported or tested in our TI Linux SDK.

    Should there be any issue integrating with the TI Linux SDK USB driver code, please feel free to open a new e2e query.

    Thanks.