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/DRA712: USB as device dis/connection event missing

Part Number: DRA712


Tool/software: Linux

Our custom board runs Android O and kernel 4.4.91 (TI provided) and is using a USB port as device which works properly.
We are trying to detect USB dis/connection events, port as device, by netlink uvents from the user space.
USB as host send dis/connection events, but as device any event is sent

Could you help with that?

  • Hi Christian,

    When you connect EVM to Linux PC for ADB, Android shows a notification.
    Is the USB roles mentioned in ADB example same as what you are looking for? J6 device and Linux PC is host.

    Regards,
    Vishal

  • Hi Vishal

    >Is the USB roles mentioned in ADB example same as what you are looking for? J6 device and Linux PC is host
    YES.

    As reference only,
    If we connect BOARD to Linux PC for ADB, dmesg shows
    [ 6153.401023] android_work: sent uevent USB_STATE=DISCONNECTED
    [ 6153.480557] android_work: sent uevent USB_STATE=CONNECTED
    [ 6153.486959] android_work: sent uevent USB_STATE=DISCONNECTED
    [ 6153.583173] android_work: sent uevent USB_STATE=CONNECTED
    [ 6153.590296] configfs-gadget gadget: high-speed config #1: b
    [ 6153.606854] android_work: sent uevent USB_STATE=CONFIGURED
    (Great!)

    But when we disconnect it, dmesg doesn't show anything.
    At this time we need to know that USB as device (BOARD side) was disconnected
  • Let me look in to this and get back.

  • Hi,

    I tested this scenario on J6 Entry TI EVM and I see the disconnect event with ADB

    jacinto6evm:/ # [ 91.988578] android_work: sent uevent USB_STATE=CONNECTED
    [ 92.002688] android_work: sent uevent USB_STATE=DISCONNECTED
    [ 92.045899] android_work: sent uevent USB_STATE=CONNECTED
    [ 92.052087] configfs-gadget gadget: high-speed config #1: b
    [ 92.073098] android_work: sent uevent USB_STATE=CONFIGURED
    jacinto6evm:/ #
    jacinto6evm:/ #
    jacinto6evm:/ # [ 98.655339] android_work: sent uevent USB_STATE=DISCONNECTED


    Regards,
    Vishal

  • Hi Vishal

    We were able to successfully detect USB_STATE=DISCONNECTED by changing our dts for VBUS gpio detection.

    We have however the following case. We are using a usb port for CarPlay. In this case, we start as HOST and provide the VBUS line. In the middle of the CarPlay session, we need to do a role swtich and became DEVICE but keeping the VBUS line high. In this case, when the apple device is unplugged, we wouldn't have a change in the VBUS line, since we are the ones that are driving it.
    1- How could we detect in such case that the connected device was unplugged?
    2- Does DRA71x support hnp?

    Thanks in advance
  • Hi Christian,

    In one of the emails exchanged earlier with TI engineer, below comment was provided, does this answer your query on VBUS?

    The USBx_DRVVBUS digital signal out from controller used to switch ON/OFF the VBUS.
    The controller will set drvvbus only in Host mode, in gadget mode the drvvbus will goes LOW.
    The solution to this is to control the USBx_DRVVBUS using gpio instead of drvvbus from USBIP

  • Hi Vishal,

    I'm Alejandro, I work with Christian on the same company. Our issue is not controlling the VBUS line. We have a usb port that is used to connect an iPhone and use CarPlay. In this scenario, the port starts as host, and during the session, the iPhone will eventually ask for a role-switch. The port will then go to gadget mode. In either mode, we must keep the VBUS line high. This is ok, we are able to do this because we are not using the drvvbus line to set the state, in fact, we always keep the VBUS line high.

    Keeping in mind that VBUS will always be high, then our question is how can we detect the iPhone was disconnected when we are in gadget mode. In the above case you mention with adb, we were able to set it up with our board just like with the EVM, buy using the vbus-gpio setting in the device tree. But since in this case the VBUS line will not change its state, then we would not be able to detect the disconnection this way...

    Thanks a lot for the support, regards,
    Alejandro
  • Hi Alejandro,

    Could you open a new E2E topic for this?

    Regards,
    Vishal