[TriLUG] Intermittent USB Keyboard [SOLVED]
Bill Farrow via TriLUG
trilug at trilug.org
Thu Jun 25 12:59:42 EDT 2015
Hello,
I have a story to tell you about a problem that might impact other
people. As yet, I do not know the cause, only what seems to have
solved it.
It all started last week when I did a routine "aptitude update &&
aptitude safe-upgrade". For most people is a standard and uneventful
procedure. This is not the case when you run Debian Unstable (sid).
This is compounded by the fact that I am running a Dell M6800 laptop
which uses both the Intel and Nvidia graphics to have 3 displays.
The first thing that didn't work after the upgrade was the the
multi-monitor setup. This was resolved by building the
intel-virtual-output tool from the upstream xf86-video-intel driver.
sudo modprobe bbswitch
sudo optirun true
/home/bill/src/xf86-video-intel/tools/intel-virtual-output
So here I am in multi-monitor bliss doing my work and keystrokes start
disappearing. At first I thought I was overly stressed after the
multi-monitor issue had put me behind schedule. The problem was
intermittent. I would be typing an email and only half words would
appear on the screen.
I rolled back the kernel to 3.x and the problem persisted. I thought
about rolling back the xorg drivers but decided that was going to
cause more pain. Are there any mainstream distros that provide
seamless OS rollback ?
I noticed that the laptop keyboard didn't have this issue, only the
external Dell USB keyboard. Ha ! Could it be xorg event handling ?
Maybe it had something to do with running two xorg servers at the same
time to get multi-monitor working on this laptop ?
Why would this only effect the USB keyboard ? Is USB power saving
turning off my keyboard ?
lsusb
Bus 003 Device 031: ID 413c:2110 Dell Computer Corp.
Bus 003 Device 030: ID 413c:1010 Dell Computer Corp.
cat /sys/bus/usb/devices/3-4.1.4/power/autosuspend
2
cat /sys/bus/usb/devices/3-4.1.4/power/control
auto
The kernel documentation says that autosuspend is in seconds, and
"auto" means the kernel can power it down when it is idle for more
than 2 seconds.
https://www.kernel.org/doc/Documentation/usb/power-management.txt
A quick bash script later, and I had a way to disable autosuspend on
the USB keyboard, the HUB it is connected to, and the other
peripherals on that HUB just for good measure.
#!/bin/bash
echo "DEVID Control Auto Delay State Description"
for DIR in /sys/bus/usb/devices/3-4* ;
do
if [ -e ${DIR}/product ];
then
VENID=$(cat ${DIR}/idVendor);
PRODID=$(cat ${DIR}/idProduct);
PRODUCT=$(cat ${DIR}/product);
CONTROL=$(cat ${DIR}/power/control);
AUTO=$(cat ${DIR}/power/autosuspend);
DELAY=$(cat ${DIR}/power/autosuspend_delay_ms);
STATE=$(cat ${DIR}/power/runtime_status);
echo "$VENID:$PRODID $CONTROL $AUTO $DELAY $STATE
$PRODUCT $DIR";
# Disable autosuspending of Keyboard and mice
echo "on" > ${DIR}/power/control;
fi;
done
Solved? The keyboard now works without intermittently losing or
dropping keystrokes. I have no idea what changed on my laptop to
create this issue, or if I have truly solved the problem. Shouldn't
there be a whitelist of USB devices that shouldn't normally be powered
down ?
Bill
More information about the TriLUG
mailing list