Closed Bug 1017461 Opened 10 years ago Closed 10 years ago

[Dolphin] USB tethering does not work after re-plug-in USB.

Categories

(Firefox OS Graveyard :: GonkIntegration, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(blocking-b2g:1.4+, b2g-v1.4 affected, b2g-v2.0 wontfix)

RESOLVED WONTFIX
blocking-b2g 1.4+
Tracking Status
b2g-v1.4 --- affected
b2g-v2.0 --- wontfix

People

(Reporter: sku, Unassigned, NeedInfo)

Details

(Whiteboard: [sprd313382][partner-blocker][POVB])

Attachments

(1 file)

STR:
1. Enable wifi (or data connection) on dolphin device
2. plug-in USB
3. Goto Settings -> Internet sharing -> enable "USB tethering"
4. remove USB, and plug-in again

Symptom:
 USB tethering does not work until re-toggle "USB tethering" again.

Expectation:
 USB tethering can work properly after re-plug-in USB.

Version:
Gaia      7bc1c15c67661a0b8e35f18f15a9d03d1d2cfcd5
Gecko     7e44b07e718ae3b4359629d5328489472c1dbeb0
BuildID   20140529143620
Version   30.0
ro.build.version.incremental=eng.sku.20140529.142708
ro.build.date=Thu May 29 14:29:09 CST 2014
blocking-b2g: --- → 1.4?
Whiteboard: [sprd313382]
Tim

Can we please review from a settings perspective?

Please reassign appropriately.
Flags: needinfo?(timdream)
I am wondering if this is related to the usb driver and should be platform specific problem ?
Yes, this is device and platform specific.

GonkIntegation?
Flags: needinfo?(timdream)
Component: General → GonkIntegration
PTR1 Block issue.
and, our network configuration is:
   "tethering.usb.ip": "192.168.42.129",
   "tethering.usb.prefix": "24",
   "tethering.usb.dhcpserver.startip": "192.168.42.2",
   "tethering.usb.dhcpserver.endip": "192.168.42.254",
   "tethering.wifi.ip": "192.168.42.129",
   "tethering.wifi.prefix": "24",
   "tethering.wifi.dhcpserver.startip": "192.168.42.2",
   "tethering.wifi.dhcpserver.endip": "192.168.42.254"
Thomas,

Please help with reassigning this blocker.
blocking-b2g: 1.4? → 1.4+
Flags: needinfo?(ttsai)
Fixing the needinfo to Thomas's alias.
Flags: needinfo?(ttsai) → needinfo?(ttsai)
Whiteboard: [sprd313382] → [sprd313382][partner-blocker]
I tested in Flame v1.4, but didn't see this problem following the same steps as comment 0. 

Here is the test build:

│ Gaia      1f238df7ac68a73a4ceb27391a204c800f38ab1c                         │
│ Gecko                                                                      │
│ https://hg.mozilla.org/releases/mozilla-b2g30_v1_4/rev/a7b7f1b579cc        │
│ BuildID   20140605000203                                                   │
│ Version   30.0                                                             │
│ ro.build.version.incremental=94                                            │
│ ro.build.date=Tue May 20 09:29:20 CST 2014
spreadtrum is still working on it.
This is identified as partner issue. Partner is clarifing it now. Set falg to POVB.
Whiteboard: [sprd313382][partner-blocker] → [sprd313382][partner-blocker][POVB]
It seems kernel 3.10 has different usb switch behavior, so can usb tethering setting monitor the usb cable status? If usb cable is disconnected,usb tethering is disabled. A user has to enable usb tethering again if usb cable connects to pc again.
Flags: needinfo?(vchang)
Flags: needinfo?(arthur.chen)
(In reply to thomas tsai from comment #11)
> It seems kernel 3.10 has different usb switch behavior, so can usb tethering
> setting monitor the usb cable status? If usb cable is disconnected,usb
> tethering is disabled. A user has to enable usb tethering again if usb cable
> connects to pc again.

I don't know what is being asked explicitly. Are you asking Settings to silently turn off USB tethering when the USB is disconnected so that user could turn it on again when re-plugged again? Can we absorb this behavior difference in the Gecko/Gonk level instead?
Flags: needinfo?(arthur.chen)
We do not mess with user preferences unless it's absolutely necessary.
By checking the kernel driver , u_ether.c and android.c in usb gadget driver, the MAC address is obtained randomly at the first time when driver inits and then the MAC address is fixed. We found nexus4 (kitkat+v1.4)always has the same fixed MAC address in usb tethering mode after cable status is out and in, but dolphin mac changes everytimes when cable is out and in. Nexus4 usb tethering work, but dolphin is not. We need to check if kernel 3.10 has this different behavior to kernel 3.4 or earlier kernel version.
1. We tried to use fixed MAC in kernel for usb tethering, but it still fails.
2. We tried to set "sys.usb.config" to "adb,rnds" or "adb" to simulate the usb tethering toggle, it still fails.
3. android has a usbmanager in java to monitor the usb cable status, so a usb cable out and in will disable usb tethering and a user needs to "enable" usb tethering again.
Flags: needinfo?(siiaceon.cao)
I don't think it's POVB bug, it's caused by android4.4 and kernel 3.10 adb change.
Whiteboard: [sprd313382][partner-blocker][POVB] → [sprd313382][partner-blocker]
Renfeng's workaround patch, the same behavior as android4.4.
Flags: needinfo?(janjongboom)
Comment on attachment 8439809 [details] [diff] [review]
tethering.usb.enabled.disabled_when_outof_usb.patch

I'm not a peer for system, redirecting r? to Tim. He has to give his opinion on the approach taken here.

Some comments on the patch.

>diff --git a/apps/system/js/statusbar.js b/apps/system/js/statusbar.js
>index ab77fec..fc774eb 100644
>--- a/apps/system/js/statusbar.js
>+++ b/apps/system/js/statusbar.js
>@@ -324,6 +324,7 @@ var StatusBar = {
>       case 'levelchange':
>       case 'statuschange':
>         this.update.battery.call(this);
>+        this.update.usbtethering.call(this);

Please either rename this to 'usbTethering', or to 'disableTetheringOnDischarge', something like that.

>         break;
> 
>       case 'voicechange':
>@@ -665,6 +666,21 @@ var StatusBar = {
>       icon.dataset.level = Math.floor(battery.level * 10) * 10;
>     },
> 
>+    usbtethering: function sb_usbtethering(){
>+      var battery = window.navigator.battery;
>+      if (!battery)
>+        return;
>+      if (!this.settingValues['tethering.usb.enabled']){
>+        return;
>+      }
>+      if (battery.charging){
>+        return;
>+      }

Can be rewritten to: `if (!navigator.batter || !this.settingValues['tethering.usb.enabled']) { return; }`

>+      var settings = window.navigator.mozSettings;
>+      var cset = {}; cset['tethering.usb.enabled'] = battery.charging;
>+      settings.createLock().set(cset);

Can be rewritten to `navigator.mozSettings.createLock().set({ 'tethering.usb.enabled': battery.charging })`

>+    },
>+
Attachment #8439809 - Flags: review?(timdream)
Comment on attachment 8439809 [details] [diff] [review]
tethering.usb.enabled.disabled_when_outof_usb.patch

See comment 12. I believe Gecko/Gonk should be responsible of adsorb the behavior, compare to quietly turning off the tethering for user.
Attachment #8439809 - Flags: review?(timdream)
(In reply to thomas tsai from comment #15)
> 3. android has a usbmanager in java to monitor the usb cable status, so a
> usb cable out and in will disable usb tethering and a user needs to "enable"
> usb tethering again.

However, if UX thinks it's a good idea to follow the Android behavior here, I don't have a strong opinion on reinventing Android.
Flags: needinfo?(firefoxos-ux-bugzilla)
(In reply to thomas tsai from comment #11)
> It seems kernel 3.10 has different usb switch behavior, so can usb tethering
> setting monitor the usb cable status? If usb cable is disconnected,usb
> tethering is disabled. A user has to enable usb tethering again if usb cable
> connects to pc again.

The AutoMounter also monitors usb cable status.
http://dxr.mozilla.org/mozilla-central/source/dom/system/gonk/AutoMounter.cpp#104

The AutoMounter also uses a UsbCableObserver
http://dxr.mozilla.org/mozilla-central/source/dom/system/gonk/AutoMounter.cpp#708
which uses GonkSwitch

If the behaviour has changed, then we'll need to update GonkSwitch and/or the AutoMounter.
Flagging Omega, but initial UX response is that when the user plugs in a USB cable, it should work. The user should not have to plug in the USB cable and also enable USB tethering. 

Speaking as someone who flashes my Flame 2-5 times/day, I honestly wouldn't think to even have to enable USB anything. I would just assume the USB port or cable was broken, not that I needed to change a tethering setting.

But Omega may feel differently. ;)
Flags: needinfo?(firefoxos-ux-bugzilla) → needinfo?(ofeng)
Hello Stephany and all, from UX's perspective, USB tethering should work properly whenever USB tethering is turned on (and USB plugged-in). If USB tethering is turned off and USB plugged in, user needs to manually turned on the setting for it to work. Tks!
Flags: needinfo?(ofeng)
I found rndis interface is turned down after unplug and plug usb cable. Not sure if the configuration of the interface is modified by driver level or gonk level. If you set the ip address manually, you can find the the kernel's mac layer connection is still there. Maybe rndis gadget driver does the trick? Or a certain process in gonk(netd for example) listens to usb plug/unplug event and reset the rndis interface's configuration when it is unplugged?      

Can we have some inputs from the partner first?  

Step 1, 
Device side,
busybox ifconfig rndis0 192.168.99.1 up 

Step 2, 
PC side, 
ifconfig usb0 192.168.99.2 up 

Step 3, 
From pc to ping device. 
ping 8.8.8.8
Flags: needinfo?(vchang)
Flags: needinfo?(janjongboom)
Hi James: can you find one to answer Vincent's comment?
Flags: needinfo?(ttsai) → needinfo?(james.zhang)
Loop Lianxiang.
Flags: needinfo?(james.zhang) → needinfo?(lianxiang.zhou)
After Vincent provided his comment #24, we are still waiting for the reply for 2 weeks. James, can you help to push on your side to get the information from Lianxiang? Thank you.
Flags: needinfo?(james.zhang)
(In reply to Kevin Hu [:khu] from comment #27)
> After Vincent provided his comment #24, we are still waiting for the reply
> for 2 weeks. James, can you help to push on your side to get the information
> from Lianxiang? Thank you.

If you have dolphin, you can simply have a try and don't wait our reply.

Step 1, 
Device side,
busybox ifconfig rndis0 192.168.99.1 up 

result
root@scx15_sp7715ga:/ # busybox ifconfig rndis0 192.168.99.1 up 
ifconfig: SIOCSIFADDR: No such device
Flags: needinfo?(james.zhang)
(In reply to Vincent Chang[:vchang] from comment #24)
> I found rndis interface is turned down after unplug and plug usb cable. Not
> sure if the configuration of the interface is modified by driver level or
> gonk level. If you set the ip address manually, you can find the the
> kernel's mac layer connection is still there. Maybe rndis gadget driver does
> the trick? Or a certain process in gonk(netd for example) listens to usb
> plug/unplug event and reset the rndis interface's configuration when it is
> unplugged?      
> 
> Can we have some inputs from the partner first?  
> 
> Step 1, 
> Device side,
> busybox ifconfig rndis0 192.168.99.1 up 
> 
> Step 2, 
> PC side, 
> ifconfig usb0 192.168.99.2 up 
> 
> Step 3, 
> From pc to ping device. 
> ping 8.8.8.8

1 connect wifi

2 open usb tethering and insert cable, then do a test

  1) on device
0)~/tools$ adb shell busybox ifconfig rndis0
rndis0    Link encap:Ethernet  HWaddr 2E:D2:01:71:DE:FA  
          inet addr:192.168.42.129  Bcast:192.168.42.255  Mask:255.255.255.0
          inet6 addr: fe80::2cd2:1ff:fe71:defa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:115 errors:0 dropped:0 overruns:0 frame:0
          TX packets:71 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:17203 (16.7 KiB)  TX bytes:15237 (14.8 KiB)
  2) on pc
2)~/tools$ ifconfig usb0
usb0      Link encap:以太网  硬件地址 46:70:bc:44:10:57  
          inet 地址:192.168.42.204  广播:192.168.42.255  掩码:255.255.255.0
          inet6 地址: fe80::4470:bcff:fe44:1057/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
          接收数据包:82 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:127 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000 
          接收字节:11885 (11.8 KB)  发送字节:25305 (25.3 KB)

0)~/tools$ ping -c 1 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=32 time=443 ms

--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 443.121/443.121/443.121/0.000 ms

3 we can see that the net works well.

4 set the device and pc, then go on testing
  1) on device
0)~/tools$ adb shell busybox ifconfig rndis0 192.168.99.1 up
0)~/tools$ adb shell busybox ifconfig rndis0
rndis0    Link encap:Ethernet  HWaddr 2E:D2:01:71:DE:FA  
          inet addr:192.168.99.1  Bcast:192.168.99.255  Mask:255.255.255.0
          inet6 addr: fe80::2cd2:1ff:fe71:defa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:177 errors:0 dropped:0 overruns:0 frame:0
          TX packets:98 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:21915 (21.4 KiB)  TX bytes:18499 (18.0 KiB)

  2) on pc
0)~/tools$ sudo ifconfig usb0 192.168.99.2 up
0)~/tools$ ifconfig usb0
usb0      Link encap:以太网  硬件地址 46:70:bc:44:10:57  
          inet 地址:192.168.99.2  广播:192.168.99.255  掩码:255.255.255.0
          inet6 地址: fe80::4470:bcff:fe44:1057/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
          接收数据包:98 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:198 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000 
          接收字节:12815 (12.8 KB)  发送字节:38377 (38.3 KB)

0)~/tools$ ping -c 1 8.8.8.8
connect: Network is unreachable

5 net die.

PS. Sorry for my Chinese OS, maybe you can not see some characters in the log, that is ignorable.
Flags: needinfo?(lianxiang.zhou)
Hi Vincent,

Mind if you can take a look the response from our partner and see if you can proceed the bug. Thanks.
Flags: needinfo?(vchang)
> --- 8.8.8.8 ping statistics ---
> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
> rtt min/avg/max/mdev = 443.121/443.121/443.121/0.000 ms
> 
> 3 we can see that the net works well.
> 
> 4 set the device and pc, then go on testing
>   1) on device
> 0)~/tools$ adb shell busybox ifconfig rndis0 192.168.99.1 up
> 0)~/tools$ adb shell busybox ifconfig rndis0
> rndis0    Link encap:Ethernet  HWaddr 2E:D2:01:71:DE:FA  
>           inet addr:192.168.99.1  Bcast:192.168.99.255  Mask:255.255.255.0
>           inet6 addr: fe80::2cd2:1ff:fe71:defa/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:177 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:98 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000 
>           RX bytes:21915 (21.4 KiB)  TX bytes:18499 (18.0 KiB)
> 
>   2) on pc
> 0)~/tools$ sudo ifconfig usb0 192.168.99.2 up
> 0)~/tools$ ifconfig usb0
> usb0      Link encap:以太网  硬件地址 46:70:bc:44:10:57  
>           inet 地址:192.168.99.2  广播:192.168.99.255  掩码:255.255.255.0
>           inet6 地址: fe80::4470:bcff:fe44:1057/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
>           接收数据包:98 错误:0 丢弃:0 过载:0 帧数:0
>           发送数据包:198 错误:0 丢弃:0 过载:0 载波:0
>           碰撞:0 发送队列长度:1000 
>           接收字节:12815 (12.8 KB)  发送字节:38377 (38.3 KB)
> 
> 0)~/tools$ ping -c 1 8.8.8.8
> connect: Network is unreachable
> 
> 5 net die.

Looks like that tx/rx packets are increased if you compare with the log before unplug the usb cable. Maybe you can ping to the rndis0 interface first from pc and check the connection between rndis0 in device and usb0 in pc first.  

BTW, do you know why the interface's ip address and up/down status are changed after unplug the usb cable? Does the usb rndis driver do the trick in different kernel versions?
Flags: needinfo?(vchang)
issue clear by renfeng
Flags: needinfo?(siiaceon.cao)
(In reply to siiaceon from comment #32)
> issue clear by renfeng

What does it mean for issue clear? Is it fixed by somewhere?
Flags: needinfo?(siiaceon.cao)
(In reply to Vincent Chang[:vchang] from comment #33)
> (In reply to siiaceon from comment #32)
> > issue clear by renfeng
> 
> What does it mean for issue clear? Is it fixed by somewhere?

Yep, can you clarify . Is this something that was resolved on your side which makes this POVB(part of vendor build) for us.
Hi! James,

I don't know what does comment #32 mean. 
Can you clarify? Thanks

--
Keven
Flags: needinfo?(james.zhang)
We have landed this WIP patch on my side, the same behavior as android4.4.
tethering.usb.enabled.disabled_when_outof_usb.patch
Flags: needinfo?(james.zhang)
Hi! Tim,

Need your comment on the patch provided by Sprd.
Should we review and land it? Or keep it as POVB case?
Thanks

--
Keven
Flags: needinfo?(timdream)
I've already stated my opinion on comment 12, comment 13, and comment 19.
Flags: needinfo?(timdream)
Hi! Tim,

Thanks for feedback.

Hi! James,

Since this is Dolphin specific and you landed your patch on your side.
I change this case as POVB and status as WONTFIX. Thanks

--
Keven
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(james.zhang)
Resolution: --- → WONTFIX
Whiteboard: [sprd313382][partner-blocker] → [sprd313382][partner-blocker][POVB]
(In reply to Keven Kuo [:kkuo] from comment #39)
> Hi! Tim,
> 
> Thanks for feedback.
> 
> Hi! James,
> 
> Since this is Dolphin specific and you landed your patch on your side.
> I change this case as POVB and status as WONTFIX. Thanks
> 
> --
> Keven

I can fixed on my gaia side, but I suggest gecko can support Android4.4 usb behavior, do you meet the same issue on nexus-5?
Flags: needinfo?(james.zhang)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: