(Needs xserver 1.7) Barcode reader kill X on scan

Bug #370851 reported by Mathieu
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
X.Org X server
Fix Released
Medium
xserver-xorg-input-evdev (Ubuntu)
Fix Released
High
Unassigned

Bug Description

I was using a simple USB CCD barcode reader[1] from several months ago with Ubuntu 8.04 without any trouble.
But after the upgrade to 9.04 (through 8.10), this barcode reader is not working anymore. Worst: it kill the X session as soon as I try to scan a barcode (current session is killed and the screen to log-in is shown). Pluging it does no harm, though.

Given it was working like a charm on 8.04, is there anything to add in xorg.conf?

 1. http://www.rakuten.co.jp/fksystem/702994/613735/

lsb_release -rd
Description: Ubuntu 9.04
Release: 9.04

/var/log/messages (when plugging-in the scanner)
May 2 22:19:01 kumo kernel: [21888.413149] usb 2-1: USB disconnect, address 2
May 2 22:19:16 kumo kernel: [21903.328012] usb 6-2: new low speed USB device using uhci_hcd and address 2
May 2 22:19:16 kumo kernel: [21903.503092] usb 6-2: configuration #1 chosen from 1 choice
May 2 22:19:17 kumo kernel: [21903.931545] input: Guest Generic DE64-401 as /devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.0/input/input7
May 2 22:19:17 kumo kernel: [21903.944051] cypress 0003:04B4:DE64.0004: input,hidraw3: USB HID v1.00 Keyboard [Guest Generic DE64-401] on usb-0000:00:1d.0-2/input0

Tags: crash jaunty
Revision history for this message
Mathieu (mathieu-benippon) wrote :

Just tried, and the barcode scanner does work perfectly in console tty.
I believe this bug is well related to X.org, then.

Revision history for this message
Mathieu (mathieu-benippon) wrote :

Barcode scan only kills X server, not the console tty.

affects: ubuntu → xorg-server (Ubuntu)
Revision history for this message
Bryce Harrington (bryce) wrote :

Hi mathieu-benippon,

Please attach the output of `lspci -vvnn`, and attach your /var/log/Xorg.0.log (and maybe Xorg.0.log.old) file from after reproducing this issue. If you've made any customizations to your /etc/X11/xorg.conf please attach that as well.

[This is an automated message. Apologies if it has reached you inappropriately; please just reply to this message indicating so.]

tags: added: needs-xorglog
tags: added: needs-lspci-vvnn
Changed in xorg-server (Ubuntu):
status: New → Incomplete
Revision history for this message
Martin Olsson (mnemo) wrote :

@Mathieu, can you also attach gdb to the X process and collect a full backtrace when it crashes? This would be super useful when we file an upstream bug report. Instructions on how to record a backtrace is available here: https://wiki.ubuntu.com/X/Backtracing

tags: added: crash
Revision history for this message
Mathieu (mathieu-benippon) wrote :

Bryce, Martin, thank you.

Please find requested data in the attached file:
gdb-Xorg.txt
lspci-vvnn
lsusb-v
Xorg.0.log
Xorg.0.log.old
xorg.conf

If there is any other needs just let me know.

Revision history for this message
Martin Olsson (mnemo) wrote :

Nice work Mathieu. This is the stuff we need except for one thing, the stacktrace seems to be missing function names and variables for the evdev driver. This can be fixed quite easily though. Please add these lines to your /etc/apt/sources.list file:

      deb http://ddebs.ubuntu.com jaunty main restricted universe multiverse
      deb http://ddebs.ubuntu.com jaunty-updates main restricted universe multiverse
      deb http://ddebs.ubuntu.com jaunty-security main restricted universe multiverse
      deb http://ddebs.ubuntu.com jaunty-proposed main restricted universe multiverse

And then run "sudo apt-get update". This will make a BLAH-dbgsym package available for each normal package BLAH. If you want, you can read more about this repository here: https://wiki.ubuntu.com/DebuggingProgramCrash
After you have added these ddeb repositories, please install the following packages:

sudo apt-get install xserver-xorg-input-evdev-dbgsym libc6-dbg xserver-xorg-core-dbg xserver-xorg-video-ati-dbg xserver-xorg-input-kbd-dbgsym xserver-xorg-input-synaptics-dbgsym xserver-xorg-input-mouse-dbgsym

Finally, please trigger the crash with gdb attached to the X process again just like you did before. This time hopefully
the "bt full" command will give us better data. Attach the improved output of "bt full" to the bug please. Thanks.

Revision history for this message
Mathieu (mathieu-benippon) wrote :

Martin, thanks for your easy to understand messages.

Here is the new backtrace. Good luck with it!

(both Ubuntu 8.04 and 8.10 are OK with this barcode reader, only 9.04 do crash)

Revision history for this message
In , Martin Olsson (mnemo) wrote :
Download full text (3.9 KiB)

(I'm forwarding this bug upstream on the behalf of another user,
for the original downstream bug report please see:
https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/370851 )

Repro steps:

0. (using ubuntu 9.04 final; probably works on all xserver 1.6.0 systems though)

1. attach barcode reader hw to X of model [ref #1]
2. scan a barcode ==> immediate segv in xserver, return to GDM, fail.

ref #1: the specific barcode reader hw model is:
http://www.rakuten.co.jp/fksystem/702994/613735/

Here is the "bt full":

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7a6d6d0 (LWP 4704)]
updateSlaveDeviceCoords (master=0x995c258, pDev=0x99e87f8)
    at ../../dix/getevents.c:168
168 ../../dix/getevents.c: No such file or directory.
 in ../../dix/getevents.c
(gdb) backtrace full
#0 updateSlaveDeviceCoords (master=0x995c258, pDev=0x99e87f8)
    at ../../dix/getevents.c:168
 scr = (ScreenPtr) 0x0
 i = <value optimized out>
 lastSlave = <value optimized out>
#1 0x080a0958 in GetKeyboardValuatorEvents (events=0x95ad238, pDev=0x99e87f8,
    type=2, key_code=13, first_valuator=0, num_valuators=0, valuators=0x0)
    at ../../dix/getevents.c:541
 numEvents = <value optimized out>
 ms = <value optimized out>
 sym = 52
 kbp = <value optimized out>
#2 0x080a0cda in GetKeyboardEvents (events=0x95ad238, pDev=0x99e87f8, type=2,
    key_code=13) at ../../dix/getevents.c:743
No locals.
#3 0x080d817b in xf86PostKeyboardEvent (device=0x99e87f8, key_code=13,
    is_down=1) at ../../../../hw/xfree86/common/xf86Xinput.c:931
 nevents = <value optimized out>
 i = <value optimized out>
 pointer = (DeviceIntPtr) 0x995be98
#4 0xb58893db in EvdevReadInput (pInfo=0x99b6de0) at ../../src/evdev.c:256
 ev = {time = {tv_sec = 1241755265, tv_usec = 788288}, type = 1,
  code = 5, value = 1}
 len = <value optimized out>
 value = 1
 dx = 0
 dy = 0
 abs = 0
 button = 0
 pEvdev = (EvdevPtr) 0x99e7ce0
#5 0x080c7da7 in xf86SigioReadInput (fd=30, closure=0x99b6de0)
    at ../../../../hw/xfree86/common/xf86Events.c:311
 errno_save = 11
 sigstate = 1
#6 0x080b82cc in xf86SIGIO (sig=29)
    at ../../../../../hw/xfree86/os-support/linux/../shared/sigio.c:114
 i = 1
 ready = {fds_bits = {1073741824, 0 <repeats 31 times>}}
 to = {tv_sec = 0, tv_usec = 0}
 save_errno = 11
 r = 1
#7 <signal handler called>
No symbol table info available.
#8 0xb80c6430 in __kernel_vsyscall ()
No symbol table info available.
#9 0xb7d5e77d in ___newselect_nocancel () from /lib/tls/i686/cmov/libc.so.6
No locals.
#10 0x081329f0 in WaitForSomething (pClientsReady=0x99b3398)
    at ../../os/WaitFor.c:228
 i = <value optimized out>
 waittime = {tv_sec = 59, tv_usec = 249118}
 wt = (struct timeval *) 0xbfbe3600
 timeout = <value optimized out>
 clientsReadable = {fds_bits = {0 <repeats 32 times>}}
 clientsWritable = {fds_bits = {163428176, -1213807560, 163429268,
    136208372, 163428200, 157825752, 157825752, 157950132, 2, 32, 2,
    -1210183692, -1210179264, 163431936, -1078053544, -1211157066,
    -1210179264, 163431936, 163431928, 136208372, 163431936, 163153512,
    -1078053528, 135499809, 163431936, 136208372, -1078053464, 134696004,
    163431936, 23069101, -10780...

Read more...

Revision history for this message
In , Martin Olsson (mnemo) wrote :

Created an attachment (id=25633)
xorg.log from the system with the barcode reader

Revision history for this message
In , Martin Olsson (mnemo) wrote :

Created an attachment (id=25634)
xorg.log.old from the system with the barcode reader

Revision history for this message
In , Martin Olsson (mnemo) wrote :

Created an attachment (id=25635)
lspci -vvnn from the system with the barcode reader

Revision history for this message
In , Martin Olsson (mnemo) wrote :

Created an attachment (id=25636)
lsusb -v from the system with the barcode reader

Revision history for this message
In , Martin Olsson (mnemo) wrote :

Created an attachment (id=25637)
xorg.conf from the system with the barcode reader

Revision history for this message
In , Martin Olsson (mnemo) wrote :

Created an attachment (id=25638)
GDB "bt full" showing the xserver SEGV that the barcode reader causes

Revision history for this message
In , Martin Olsson (mnemo) wrote :

When the barcode reader hw is attached /var/log/messages show this:

May 2 22:19:01 kumo kernel: [21888.413149] usb 2-1: USB disconnect, address 2
May 2 22:19:16 kumo kernel: [21903.328012] usb 6-2: new low speed USB device using uhci_hcd and address 2
May 2 22:19:16 kumo kernel: [21903.503092] usb 6-2: configuration #1 chosen from 1 choice
May 2 22:19:17 kumo kernel: [21903.931545] input: Guest Generic DE64-401 as /devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.0/input/input7
May 2 22:19:17 kumo kernel: [21903.944051] cypress 0003:04B4:DE64.0004: input,hidraw3: USB HID v1.00 Keyboard [Guest Generic DE64-401] on usb-0000:00:1d.0-2/input0

Revision history for this message
In , Martin Olsson (mnemo) wrote :

This particular barcode reader previosuly worked well using Ubuntu 8.04 hardy, which shipped the following versions:

xserver-xorg-core 1.4.1~git20080131-1ubuntu9.2
xserver-xorg-input-evdev 1.2.0-1ubuntu2

Ubuntu 9.04 jaunty where the SEGV is confirmed, uses these versions:

xserver-xorg-core 1.6.0-0ubuntu14
xserver-xorg-input-evdev 2.1.1-1ubuntu4

So this is a regression.

Versions of X server and evdev in various distro releases:
https://launchpad.net/ubuntu/+source/xserver-xorg-input-evdev
https://launchpad.net/ubuntu/+source/xorg-server

Revision history for this message
Martin Olsson (mnemo) wrote : Re: Barcode reader kill X on scan

Thanks a lot for collecting all the necessary information. I have filed an upstream bug report for the input subsystem in X.org. The upstream bug report is available here: https://bugs.freedesktop.org/show_bug.cgi?id=21630

It would be useful if you added yourself as a subscriber to that bug so you can answer any follow up questions etc (I think it's sufficient to put your e-mail in the "Add CC" and press the COMMIT button but I never tried this before without being a registered user.. otherwise you can just register an account in the upstream bugzilla tracker). Thanks.

Next step is just to see what upstream comes back with.

affects: xorg-server (Ubuntu) → xserver-xorg-input-evdev (Ubuntu)
Changed in xserver-xorg-input-evdev (Ubuntu):
status: Incomplete → Confirmed
tags: removed: needs-lspci-vvnn needs-xorglog
Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

please attach the output of evtest against the device file. It'll help
creating a software emulation of the device to reproduce the bug.

http://people.freedesktop.org/~whot/evtest.c

Revision history for this message
Martin Olsson (mnemo) wrote : Re: Barcode reader kill X on scan

@Mathieu, upstream would like you to record the signals that the barcode sends so they can trigger
the bug on their machines without having access to hardware (also useful for regression tests etc).

I've tried to outline the process for you below (let me know
if any of the steps doesn't seem to work on your machine):

 1. download the debugging utility by opening a terminal and
    running "wget http://people.freedesktop.org/~whot/evtest.c"

 2. stop the X windowing system by first running the command "sudo /etc/init.d/gdm stop"
 3. once in text mode, switch to a text based console by pressing CTRL-ALT-F1
 4. login with your normal credentials

 5. disconnect / unplug the barcode reader completely
 6. run the command "find /dev/input/event*"
 7. connect the barcode reader to the computer again
 8. run the same command "find /dev/input/event*" once more
 9. there should be exactly one device entry / line which is included
    in the second print out (that was not there the first time), this
    represents your barcode reader device and it should look something
    like "evtest" where X is some number.

11. compile the debugging utility by running "gcc evtest.c -o evtest"
12. run the debugging utility by running "./evtest /dev/input/eventX > output.txt"
    (Note: you should use the specific eventX entry for your device that
     you found using steps 1-4)

13. zap something with the barcode reader
14. press CTRL-C to terminate the evtest debugging utility

15. now the file output.txt should have a complete trace of all
    the input events that were sent by the barcode reader, the file
    should look somewhat similar to this: http://temp.minimum.se/b.txt

16. type "sudo reboot now", and attach the file you recorded to the bug report

Changed in xserver-xorg-input-evdev (Ubuntu):
status: Confirmed → Incomplete
Changed in xorg-server:
status: Unknown → Confirmed
Revision history for this message
In , Mathieu (mathieu-benippon) wrote :

Created an attachment (id=25788)
evtest output

Peter and Martin, please find evtest output attached, according to Martin's very detailed instructions:
sudo ./evtest /dev/input/event7 > output.txt

Revision history for this message
In , Mathieu (mathieu-benippon) wrote :

Created an attachment (id=25860)
evtest output of a working barcode reader

Not sure if this could be of any help, but this is the evtest output of a working barcode reader (this one : http://item.rakuten.co.jp/fksystem/z-3021/ )

Revision history for this message
In , Martin Olsson (mnemo) wrote :

Peter, is there anything else you need for this bug? Will you be able to re-create the SEGV based on the data Mathieu has supplied?

It looks like updateSlaveDeviceCoords() is calling miPointerGetScreen() which returns NULL and then updateSlaveDeviceCoords() derefs that pointer trying to get the width of the screen. I'm guessing there should be a proper Screen associated with the barcode reader device?

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

No, I can reproduce the bug with this information. Trickier than expected, I
think it triggered 5 different bugs already, some in evdev, some in xserver.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

FWIW, git master from evdev and xserver now run stable with this device. This could be interesting to cherry-pick back...

Revision history for this message
In , Martin Olsson (mnemo) wrote :

Terrific! Thanks a lot. In which X version(s) is the fix likely to ship? For potential cherry picking, do you have any SHA1's to recommend?

@Mathieu, if you're comfortable building X from source, it would be nice to get the fix confirmed.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

(In reply to comment #15)
> Terrific! Thanks a lot. In which X version(s) is the fix likely to ship? For
> potential cherry picking, do you have any SHA1's to recommend?

not yet, I need to go through all the patches I pushed over the last weeks. There was at least one or two in evdev and a few in the server.
All the fixes will be in 1.7 though.

Changed in xorg-server:
status: Confirmed → In Progress
Revision history for this message
In , Mathieu (mathieu-benippon) wrote :

Thanks Peter.

> @Mathieu, if you're comfortable building X from source

I'm afraid I'd prefer to wait for a more easy way, like a package...

Revision history for this message
In , Martin Olsson (mnemo) wrote :

Ok so, let's keep an eye on the xserver package for karmic (which I think will get updated to the 1.7 bits eventually). Once that's out you can just download and boot and ISO and test from that live CD:
https://launchpad.net/ubuntu/+source/xorg-server

Revision history for this message
In , Mathieu (mathieu-benippon) wrote :

OK, I will check with Ubuntu Karmic then.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

I'm closing this bug as FIXED. It works with current git but cherry-picking them back to 1.6.x is likely not happening. Sorry.

Changed in xorg-server:
status: In Progress → Fix Released
Bryce Harrington (bryce)
tags: added: jaunty
Bryce Harrington (bryce)
summary: - Barcode reader kill X on scan
+ (Needs xserver 1.7) Barcode reader kill X on scan
Changed in xserver-xorg-input-evdev (Ubuntu):
importance: Undecided → High
status: Incomplete → Triaged
Revision history for this message
Mathieu (mathieu-benippon) wrote :

I just tried under Karmic... I'm sorry to have to say that the bug is still present.

$ dpkg -l xserver-xorg xserver-xorg-input-evdev | grep ^i
ii xserver-xorg 1:7.4+3ubuntu10 the X.Org X server
ii xserver-xorg-input-evdev 1:2.2.5-1ubuntu6 X.Org X server -- evdev input driver

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

Fixed in lucid.

Changed in xserver-xorg-input-evdev (Ubuntu):
status: Triaged → Fix Released
Changed in xorg-server:
importance: Unknown → Medium
Changed in xorg-server:
importance: Medium → Unknown
Changed in xorg-server:
importance: Unknown → Medium
Revision history for this message
Mathieu (mathieu-benippon) wrote :

Still works well in maverick. For me, this bug can be close.

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.