Bug 6004 (int-143388)

Summary: N900 sometimes ignores USB data cable
Product: [Maemo Official Platform] Core Reporter: Marius Gedminas <marius>
Component: generalAssignee: unassigned <nobody>
Status: RESOLVED FIXED QA Contact: core-general-bugs
Severity: normal    
Priority: Low CC: andre_klapper, donn.morrison, eero.tamminen, epa, marius, ricardo.salveti, tri, yellowchilli
Version: 5.0/(1.2009.41-10)   
Target Milestone: 5.0/(2.2009.51-1)   
Hardware: N900   
OS: Linux   

Description Marius Gedminas (reporter) 2009-11-02 18:40:01 UTC
SOFTWARE VERSION:
1.2009.41-10

STEPS TO REPRODUCE THE PROBLEM:
Plug in one end of the USB cable into a laptop.  Plug in the other end into the
N900

EXPECTED OUTCOME:
N900 starts charging and shows a popup asking for USB mode.  Statusbar acquires
an USB status icon and applet.  Laptop sees the N900 with lsusb.

ACTUAL OUTCOME:
Nothing happens, as if I hadn't plugged the cable in.

REPRODUCIBILITY:
once (but when it happened, unplugging and replugging didn't work either).

OTHER COMMENTS:
I tried plugging in a different phone, to see if it was a cable or laptop
problem -- no, the other phone was charging fine.

I turned the N900 off, plugged in the cable, and it started charging at once. 
Unplugging and replugging works fine now.
Comment 1 Andre Klapper maemo.org 2009-11-03 12:25:09 UTC
Hi,

haven't seen this myself so far... syslog of the N900 (or maybe also "dmesg |
tail" of the laptop? Was it correctly recognized there?) would be nice.
Comment 2 Kimmo Hämäläinen nokia 2009-11-03 12:43:26 UTC
this is a kernel or HAL issue, nothing related to ke-recv...
Comment 3 Donn Morrison 2009-11-03 16:47:45 UTC
I can confirm that I've seen this several times. Whenever it happens I am able
to unplug and replug in the USB cable and usually after one retry it works as
expected.
Comment 4 Andre Klapper maemo.org 2009-11-03 20:39:25 UTC
If this happens again, can you please provide a syslog and the output of:
* cat /sys/devices/platform/musb_hdrc/mode 
* cat /sys/devices/platform/musb_hdrc/charger 
for both the first time it does not work and the second time that it does work?
Comment 5 Marius Gedminas (reporter) 2009-11-09 19:33:10 UTC
Just happened again: after a few hours I noticed that the N900 wasn't charging.
 Now I need to leave, and the battery is almost empty :(

~ $ cat /sys/devices/platform/musb_hdrc/mode
b_idle
~ $ cat /sys/devices/platform/musb_hdrc/charger 
0

Unplug, re-plug: device reboots.  I didn't expect *that*, but at least now it's
charging.

Correction, it doesn't reboot, it powers down to charger-only mode.  Could be a
coincidence (low battery finally ran out when I started using up the remains of
the juice for ssh over wifi).
Comment 6 Marius Gedminas (reporter) 2009-11-10 19:17:13 UTC
Okay! Happened again.  Nothing in n900's dmesg. 

~ $ cat /sys/devices/platform/musb_hdrc/mode
b_idle
~ $ cat /sys/devices/platform/musb_hdrc/charger 
0

On the laptop side, dmesg says

[332847.212055] usb 4-1: new full speed USB device using uhci_hcd and address 8
[332847.336070] usb 4-1: device descriptor read/64, error -71
[332847.513172] hub 4-0:1.0: unable to enumerate USB device on port 1

Unplug cable, re-plug: works now: popup asks me what to do, I say nothing
(charge only).  I see the battery indicator saying it is charging.

~ $ cat /sys/devices/platform/musb_hdrc/mode
b_peripheral
~ $ cat /sys/devices/platform/musb_hdrc/charger
0

dmesg on N900:

[85440.998138] musb_hdrc periph: enabled ep1in for bulk IN, maxpacket 512
[85440.998168] musb_hdrc periph: enabled ep1out for bulk OUT, maxpacket 512
[85440.998229] g_file_storage gadget: high speed config #1

dmesg on laptop:

[332956.980092] usb 1-3: new high speed USB device using ehci_hcd and address
17
[332957.113609] usb 1-3: configuration #1 chosen from 2 choices
[332957.115242] scsi15 : SCSI emulation for USB Mass Storage devices
[332957.115546] usb-storage: device found at 17
[332957.115552] usb-storage: waiting for device to settle before scanning
[332962.112525] usb-storage: device scan complete
[332962.113184] scsi 15:0:0:0: Direct-Access     Nokia    N900              031
PQ: 0 ANSI: 2
[332962.113670] scsi 15:0:0:1: Direct-Access     Nokia    N900              031
PQ: 0 ANSI: 2
[332962.114563] sd 15:0:0:0: Attached scsi generic sg2 type 0
[332962.114812] sd 15:0:0:1: Attached scsi generic sg3 type 0
[332962.130672] sd 15:0:0:0: [sdb] Attached SCSI removable disk
[332962.134172] sd 15:0:0:1: [sdc] Attached SCSI removable disk
Comment 7 Andre Klapper maemo.org 2009-11-13 13:40:55 UTC
This has been fixed in package
kernel 2.6.28-20094603+0m5
which is part of the internal build version
2009.46-16
(Note that 2009 is the year and the number after is the week.)

Any public update released with or after this build version will include the
fix.
Please verify that the new version fixes the bug by marking this bug report as
VERIFIED after the public update has been released and if you have some time.
Comment 8 Lucas Maneos 2009-11-29 03:05:17 UTC
*** Bug 6400 has been marked as a duplicate of this bug. ***
Comment 9 Venomrush 2009-12-13 13:14:04 UTC
Can I please verify that the fix is also for Bug 6400 - That the device IS
actually charging when in use with USB data cable plugged in?
Comment 10 Andre Klapper maemo.org 2009-12-14 19:43:44 UTC
(In reply to comment #9)
> Can I please verify that the fix is also for Bug 6400 - That the device IS
> actually charging when in use with USB data cable plugged in?

As I have still not run into this issue here: No idea :-/
Comment 11 Venomrush 2009-12-15 02:39:15 UTC
(In reply to comment #10)

> As I have still not run into this issue here: No idea :-/
> 

It's easy to reproduce.
Plugged in the N900 while it's on standby, you'll then see orange flashing
light indicating it's charging. Unlock the phone, start using it, orange light
turns off, you see the battery icon indicates charging but it doesn't. Best to
set the option not to turn off screen while plugged in to see the effect.
Comment 12 Marius Gedminas (reporter) 2009-12-15 12:42:04 UTC
Please let's avoid confusion.  This bug is about the N900 not noticing when a
cable is plugged and not starting to charge.

Bug 6400 is mostly about the LED not indicating charging state when the screen
is on, which, I think, is "working as designed": the LED is always off when the
screen is on, AFAICT.

There was a small aside in the initial report of bug 6400 that mentioned this
particular case (not charging when plugged in), but I don't think it should've
been marked as a duplicate of this one.
Comment 13 Marius Gedminas (reporter) 2009-12-22 10:24:29 UTC
More data:

* Once (~two days ago) I plugged in the wall charger when the device battery
was something like 95% full.  Nothing happened: no charging indication, nothing
in dmesg, /sys/devices/platform/musb_hdrc/charger showed "1".  I installed
sysklogd, unplugged, re-plugged and it started charging.  Nothing in dmesg or
syslog, except "regulator_disable: not in use by this consumer", and I've no
clue what that means and if it's related to battery charging or, I dunno, WiFi
frequencies or something.

* The second time, last night, I plugged in the charger and went to sleep.  I
think the battery was also close to full, and I didn't notice the orange LED
turning on when I put it away.  In the morning the alarm woke me up, and when I
acknowledged it, the device asked me if I wanted to turn it on.  The LED was
blinking orange indicating charging, meaning it didn't charge all night and
only started to in the morning.  uptime shows 13 minutes.

So, I've seen two devices (loaned N900 and my own N900) ignore two kinds of
chargers (data cable, wall cable) with two different firmware versions (41-10
and 42-11) in two different situations (battery near empty; battery near full).
 Two bugs or one?

I'd love to hear at least some details about the fix already present in the
unreleased internal builds.
Comment 14 Eric 2010-01-14 07:41:04 UTC
i have the exact same problem...on latest firmware.
i cant be 100% sure but it feels as though battery usage is heavier while this
bug is active.
Comment 15 Andre Klapper maemo.org 2010-01-14 12:21:41 UTC
The problem reported here should be fixed in the update released today for
public: The Maemo5 update version 2.2009.51-1 (also called "PR1.1" sometimes).
Please leave a comment if the problem is not fixed for you in this update
version.
Comment 16 Janne Pänkälä 2010-01-14 13:29:12 UTC
*** Bug 7627 has been marked as a duplicate of this bug. ***
Comment 17 Andre Klapper maemo.org 2010-01-14 14:10:17 UTC
(In reply to comment #14)
> i have the exact same problem...on latest firmware.

Please always be exact. "Latest firmware" can really mean anything and hence
such comments are not helpful.
Comment 18 Eric 2010-01-14 14:43:21 UTC
Hi Andre, sorry about that. I did mean the update before '2.2009.51-1'. that
wasnt long ago so I thought it'll be quite some time before the next update.

I'm downloading 2.2009.51-1 PR 1.1 now. thank you.
HUGE changelog :)

(In reply to comment #17)
> (In reply to comment #14)
> > i have the exact same problem...on latest firmware.
> 
> Please always be exact. "Latest firmware" can really mean anything and hence
> such comments are not helpful.
>
Comment 19 Janne Pänkälä 2010-01-20 20:07:34 UTC
I have been unable to reproduce this in 2.2009.51-1
Comment 20 Charles 2010-02-20 14:21:01 UTC
This issue CAN be reproduced in 2.2009.51-1

Exact description as Marius Gedminas
Comment 21 Eero Tamminen nokia 2010-02-24 14:45:59 UTC
(In reply to comment #20)
> This issue CAN be reproduced in 2.2009.51-1
> 
> Exact description as Marius Gedminas

What dmesg tells?
Comment 22 Venomrush 2010-03-01 23:19:57 UTC
Maybe related to bug 9210 as well?
Comment from Kimmo "There is one case when unmounting fails because of someone
using the card, possibly tracker, and another case when it fails because the
USB cable was disconnected too early."