RE: No carrier lost information with gadget RNDIS/ECM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
> > I have rebooted with 4.9:
> > [    0.658594] ci_hdrc ci_hdrc.0: entering suspend
> > # ConfigFS setup in userspace
> >  [    9.925361] ci_hdrc ci_hdrc.0: leaving suspend
> > [   12.081571] ci_hdrc ci_hdrc.0: entering suspend
> > # Attach a cable
> > [   37.869333] ci_hdrc ci_hdrc.0: leaving suspend
> > # Detach a cable
> > [   49.196610] ci_hdrc ci_hdrc.0: entering suspend
> 
> With 4.9, there are two ci_irq interrupts with OTGSC_BSVIS set
> (b_sess_valid_event), one when attaching the cable, one when detaching the cable.
> 
> > And with 4.19:
> > [    0.176297] ci_hdrc ci_hdrc.0: entering suspend
> > # ConfigFS setup in userspace
> > [    9.034493] ci_hdrc ci_hdrc.0: leaving suspend
> > [   11.128469] ci_hdrc ci_hdrc.0: entering suspend
> > # Attach a cable
> > [  178.712206] ci_hdrc ci_hdrc.0: leaving suspend # Detach the cable
> > and nothing happens
> 
> With 4.19, there's only one ci_irq interrupt with OTGSC_BSVIS set
> (b_sess_valid_event): The one when attaching the cable. There is no IRQ when
> detaching the cable.
> 

That's very strange, that means the SoC doesn't know VBUS fails down after detaching from the host.
You could measure the VBUS value at the board, then read the VBUS value at register to confirm it.
 I just tried my board (imx6sx-sdb), it worked OK at at v5.2-rc5. If you have
memtool (the tool to read physical memory), you could read register OTGSC
at that time using below command:

The value should like below, bit 9 - bit 11 stands for VBUS value.
# cable attach
root@imx6qpdlsolox:~# /unit_tests/memtool 0x21841a4 1
E
Reading 0x1 count starting at address 0x021841A4

0x021841A4:  09242F20

# cable detach
root@imx6qpdlsolox:~# /unit_tests/memtool 0x21841a4 1
E
Reading 0x1 count starting at address 0x021841A4

0x021841A4:  09341120

If you read the register after detaching the cable, please disable runtime pm using below commands:

for i in $(find /sys -name control | grep usb);do echo on > $i;echo "echo on > $i";done;

> >> Besides, what's your expectation for rndis behaviors for both windows
> >> and mac
> >
> > Going back to the original mail: In my application, I want to detect on my gadget
> when the USB cable is pulled from or connected to the host. With Kernel 4.9 I am
> using the carrier state change of the RNDIS or ECM network interface through
> systemd-networkd. With 4.19 and 5.1 (the two versions I had tested), I get the
> "Gained carrier" message when I connect for the first time, but after disconnecting,
> the "Lost carrier" message doesn't appear as with 4.9. In the one test where it
> appeared, it took over 14 hours...
> 
 
You could poll the /sys/class/udc/ci_hdrc.0/state to know the connection.

root@imx6qpdlsolox:~# [  230.074850] configfs-gadget gadget: high-speed config #1: c

root@imx6qpdlsolox:~# cat /sys/class/udc/ci_hdrc.0/state  <=== cable attached
configured
root@imx6qpdlsolox:~# cat /sys/class/udc/ci_hdrc.0/state  <=== cable detached
not attached

Peter




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux