413c:8140 [Dell Latitude D630] Bluetooth incorrectly removes input devices

Bug #1117608 reported by KarlRelton
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Incomplete
Medium
Unassigned

Bug Description

Linux kernels after 3.2 introduced battery status reporting for devices such as bluetooth keyboards and mouse.

Unfortunately there is an issue when such input devices are removed:

- a battery status report is requested
- this fails, because the device is being removed (communications with it are now down)
- the failure results in a 5 second wait (the code has a 5 second timeout)

- the bluetooth hci code has a race condition: the 5 second delay means one thread definitely loses the race
- the race condition leads to devices in the sysfs tree being removed in the wrong order
- this leads to udev events being sent out with 'truncated paths'
- this leads to userspace programs like Xorg evdev ignoring the event, but then getting confused about what keyboard/mice are actually attached
- this results in bluetooth keyboard/mice not working after a suspend/resume (because on resume the input devices are first removed, and then re-added)
---
ApportVersion: 2.6.1-0ubuntu9
Architecture: i386
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: karl 2108 F.... pulseaudio
DistroRelease: Ubuntu 12.10
HibernationDevice: RESUME=UUID=a82d4a59-432d-4d4b-9d27-557f669eb637
MachineType: Dell Inc. Latitude D630
MarkForUpload: True
Package: linux (not installed)
PccardctlIdent:
 Socket 0:
   no product info available
PccardctlStatus:
 Socket 0:
   no card
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_GB.UTF-8
 SHELL=/usr/bin/tcsh
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.8.0-4-generic root=UUID=84c73eda-43e4-429c-8428-0a37de7b6de5 ro quiet splash vt.handoff=7
ProcVersionSignature: Ubuntu 3.8.0-4.8-generic 3.8.0-rc6
RelatedPackageVersions:
 linux-restricted-modules-3.8.0-4-generic N/A
 linux-backports-modules-3.8.0-4-generic N/A
 linux-firmware 1.95
Tags: quantal running-unity
Uname: Linux 3.8.0-4-generic i686
UpgradeStatus: Upgraded to quantal on 2012-10-23 (107 days ago)
UserGroups: adm admin audio cdrom dialout dip fax floppy lpadmin netdev plugdev powerdev scanner tape video
WpaSupplicantLog:

dmi.bios.date: 06/20/2008
dmi.bios.vendor: Dell Inc.
dmi.bios.version: A12
dmi.board.name: 0KU184
dmi.board.vendor: Dell Inc.
dmi.chassis.type: 8
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvrA12:bd06/20/2008:svnDellInc.:pnLatitudeD630:pvr:rvnDellInc.:rn0KU184:rvr:cvnDellInc.:ct8:cvr:
dmi.product.name: Latitude D630
dmi.sys.vendor: Dell Inc.

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote :

cat /proc/version_signature
Ubuntu 3.8.0-4.8-generic 3.8.0-rc6

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote :

Upstream bug is https://bugzilla.kernel.org/show_bug.cgi?id=52471

Note two patches proposed there, which if applied together fix the problem (I have fixed it on my 3.8-rc6 kernel)

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote :

I believe this bug is the real root cause of
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-evdev/+bug/1075478

Xorg is not at fault, it is racy code (plus the hideous 5 second timeout) in the kernel

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote :

Note also the race conditions in the bluetooth code can also lead to a kernel OOPS, as reported in
https://bugzilla.kernel.org/show_bug.cgi?id=50541

Removing the 5 second delay avoids that race condition however.

Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 1117608

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Changed in linux (Ubuntu):
importance: Undecided → Medium
Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : AlsaInfo.txt

apport information

tags: added: apport-collected quantal running-unity
description: updated
Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : BootDmesg.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : CRDA.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : CurrentDmesg.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : IwConfig.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : Lspci.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : Lsusb.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : ProcInterrupts.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : ProcModules.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : PulseList.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : RfKill.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : UdevDb.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : UdevLog.txt

apport information

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : WifiSyslog.txt

apport information

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
KarlRelton (karllinuxtest-relton) wrote : Re: bluetooth incorrectly removes input devices

Note the truncated device paths for the removal of the input/event devices, which comes after the removal of the 'hci' device.

The correct order should work from the bottom up of the tree (so hci device removed last).

Revision history for this message
KarlRelton (karllinuxtest-relton) wrote :

Here is a snippet of kern.log after a resume, with printk added to hidp_session() and hidp_get_raw_report().

When the connection is taken down, hidp_session() exists its main loop (prints 'out of loop' message).
It then does a hid_destroy_device() ... which invokes sysfs removal of the input device. BUT that invokes a battery lookup (in power_supply code), which calls back hidp_get_raw_report ... which stalls and waits for its 5 second timeout. Only then does hidp_session finally complete. Notice the 5 second time jump in this log snippet.

Revision history for this message
penalvch (penalvch) wrote :

KarlRelton, as per http://www.dell.com/support/troubleshooting/us/en/19/Product/latitude-d630 an update is available for your BIOS (A19). If you update to this, does it change anything?

If not, could you please both specify what happened, and provide the output of the following terminal command:
sudo dmidecode -s bios-version && sudo dmidecode -s bios-release-date

Thank you for your understanding.

tags: added: bios-outdated-a19 needs-upstream-testing regression-potential
summary: - bluetooth incorrectly removes input devices
+ 413c:8140 [Dell Latitude D630] Bluetooth incorrectly removes input
+ devices
Changed in linux (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
KarlRelton (karllinuxtest-relton) wrote :

I would be very surprised if the Dell BIOS update changed anything.

Actually this bug can now be closed. Good bluetooth work was done in the kernel, which made it into the 3.10 tree. So Ubuntu 13.10 installations won't have this bug.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.