The crashes are not so random any more. They happen every time when
music stops playing. This was not simple to find, because I use ALSA
with the dmix plugin (but without any sound daemon like ESD or
PulseAudio). Usually I pause my music (XMMS) and sometimes my browser
has some Flash applets running which also occupy the audio output. So
audio is not always stopped, when I hear it to stop.

So, I found out that when I start music (e.g. with a simple "aplay
xyz.wav") without any other program doing sound output, g15daemon is
automagically started by udevd. As soon as the music stops (^C to aplay)
g15daemon is stopped by udevd. I've set the 
  G15DEBUG="on"
in /etc/default/g15daemon and activated moderate debug output by udev
with
  udevadm control --log-priority info
The output as observed in /var/log/syslog is attached in the two files
syslog-aplay-{start,stop}.txt.

It seems that every time aplay (or any other sound output) is running,
the device file /dev/usbdev2.3_ep01 is created. Endpoint 1 (OUT) is the
AudioStreaming isochronous endpoint. It seems that this "magically"
turns up upon audio output and vanishes afterwards. OTOH, according to
lsusb, the USB descriptor doesn't change at all in these two conditions
(see attached files lsusb-z10-{playing,silent}.txt), the only difference
is the "Report Descriptor" which seems cannot be queried during audio
output.

So, the first question is: Why does udev send "add" and "remove" events
just because an USB device is used although no endpoints are added or
removed?

The second question is: Why do the G15 scripts start and stop the
g15daemon for each of these events?

I've now added some more debug output on the udev environment variables
and found the following information when starting and stopping playing
audio output:
  Sep 23 21:40:16 hansi g15: calling g15 udev; action: "add", product "", 
devtype "", devname "/dev/usbdev2.6_ep01", subsystem "usb_endpoint"
  Sep 23 21:40:17 hansi g15: calling g15 udev; action: "remove", product "", 
devtype "", devname "/dev/usbdev2.6_ep01", subsystem "usb_endpoint"

It should be possible to add conditions to /etc/init.d/g15daemon to
avoid these problems. Additionally I think the additional "shared-udev"
parameter can be removed.

When the G15 speakers are plugged in and removed from the USB bus, the
debug output by /etc/init.d/g15daemon is as shown in the attached files
usb-{plugin,remove}-z10.txt (note that usb-plugin-z10.txt is partly
cluttered by a concurrently playing sound).

The unique removal event is 
  action: "remove", product "46d/a07/1e", devtype "usb_interface", devname "", 
subsystem "usb"
while for the plugin of the speakers the devtype "usb_interface" event
is twice. So I suggest to use the following event:
  action: "add", product "46d/a07/1e", devtype "usb_device", devname 
"/dev/bus/usb/002/006", subsystem "usb"
Unfortunately a little delay is necessary because g15daemon wants to
open /dev/uinputX (or so) which will be populated shortly after this
event.

I've added these additional conditions to the script, see attached patch
etc-init.d-g15daemon.patch. With these changes g15daemon is not killed
any more and works flawlessly. But please check with other supported
devices. As already mentioned, I think that then the special
"shared-udev" parameter of the script can be removed.

Bye
  Hansi

Sep 23 21:04:01 hansi udevd[1103]: seq 2995 queued, 'add' 'usb_endpoint' 
Sep 23 21:04:01 hansi udevd[1103]: seq 2995 forked, pid [31305], 'add' 
'usb_endpoint', 0 seconds old 
Sep 23 21:04:01 hansi udevd-event[31305]: device 0x96510b0 has devpath 
'/devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.1/usb_endpoint/usbdev2.3_ep01' 
Sep 23 21:04:01 hansi udevd-event[31305]: LINK 'char/251:17' 
/lib/udev/rules.d/50-udev.rules:2 
Sep 23 21:04:01 hansi udevd-event[31305]: device 0x967b270 has devpath 
'/devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.1' 
Sep 23 21:04:01 hansi udevd-event[31305]: device 0x96801c8 has devpath 
'/devices/pci0000:00/0000:00:1d.0/usb2/2-2' 
Sep 23 21:04:01 hansi udevd-event[31305]: device 0x96809a8 has devpath 
'/devices/pci0000:00/0000:00:1d.0/usb2' 
Sep 23 21:04:01 hansi udevd-event[31305]: device 0x9680890 has devpath 
'/devices/pci0000:00/0000:00:1d.0' 
Sep 23 21:04:01 hansi udevd-event[31305]: device 0x9680c10 has devpath 
'/devices/pci0000:00' 
Sep 23 21:04:01 hansi udevd-event[31305]: RUN 
'socket:@/org/freedesktop/hal/udev_event' /lib/udev/rules.d/90-hal.rules:2 
Sep 23 21:04:01 hansi udevd-event[31305]: RUN '/etc/init.d/g15daemon udev' 
/etc/udev/rules.d/z60_g15daemon.rules:16 
Sep 23 21:04:01 hansi udevd-event[31305]: no node name set, will use kernel 
name 'usbdev2.3_ep01' 
Sep 23 21:04:01 hansi udevd-event[31305]: create db link (usbdev2.3_ep01 
char/251:17) 
Sep 23 21:04:01 hansi udevd-event[31305]: creating device node 
'/dev/usbdev2.3_ep01', devnum=251:17, mode=0660, uid=0, gid=0 
Sep 23 21:04:01 hansi udevd-event[31305]: mknod(/dev/usbdev2.3_ep01, 020660, 
(251,17)) 
Sep 23 21:04:01 hansi udevd-event[31305]: chmod(/dev/usbdev2.3_ep01, 020660) 
Sep 23 21:04:01 hansi udevd-event[31305]: chown(/dev/usbdev2.3_ep01, 0, 0) 
Sep 23 21:04:01 hansi udevd-event[31305]: '/dev/char/251:17' with target 
'/dev/usbdev2.3_ep01' has the highest priority 0, create it 
Sep 23 21:04:01 hansi udevd-event[31305]: creating symlink '/dev/char/251:17' 
to '../usbdev2.3_ep01' 
Sep 23 21:04:01 hansi udevd-event[31305]: passed 298 bytes to monitor 0x96618c8 
Sep 23 21:04:01 hansi udevd-event[31305]: '/etc/init.d/g15daemon udev' 
Sep 23 21:04:01 hansi g15: calling g15 udev; action: add, product 
Sep 23 21:04:01 hansi g15daemon: Process died - removing pidfile
Sep 23 21:04:02 hansi udevd-event[31305]: '/etc/init.d/g15daemon' returned with 
status 0 
Sep 23 21:04:02 hansi udevd-event[31305]: passed -1 bytes to monitor 0x96511f0 
Sep 23 21:04:02 hansi udevd-event[31305]: seq 2995 exit with 0 
Sep 23 21:04:02 hansi udevd[1103]: seq 2995 cleanup, pid [31305], status 0, 1 
seconds old 
Sep 23 21:04:02 hansi g15daemon[31310]: Booting plugin "Linux UINPUT Keyboard 
Output"
Sep 23 21:04:02 hansi g15daemon[31310]: Plugin "Linux UINPUT Keyboard Output" 
boot successful.
Sep 23 21:04:02 hansi g15daemon[31310]: Booting plugin "Clock"
Sep 23 21:04:02 hansi g15daemon[31310]: Plugin "Clock" boot successful.
Sep 23 21:04:02 hansi udevd[1103]: seq 2996 queued, 'add' 'input' 
Sep 23 21:04:02 hansi udevd[1103]: seq 2996 forked, pid [31315], 'add' 'input', 
0 seconds old 
Sep 23 21:04:02 hansi udevd[1103]: seq 2997 queued, 'add' 'input' 
Sep 23 21:04:02 hansi kernel: [19905.631182] input: G15 Extra Keys as 
/devices/virtual/input/input50
Sep 23 21:04:02 hansi udevd-event[31315]: RUN '/sbin/modprobe -b 
$env{MODALIAS}' /lib/udev/rules.d/80-drivers.rules:10 
Sep 23 21:04:02 hansi udevd-event[31315]: RUN 
'socket:@/org/freedesktop/hal/udev_event' /lib/udev/rules.d/90-hal.rules:2 
Sep 23 21:04:02 hansi udevd-event[31315]: '/sbin/modprobe -b 
input:b0003v0000p0000e0004-e0,1,k71,72,73,74,75,76,77,78,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86,87,88,89,8A,8B,8C,8D,8E,8F,90,91,92,93,94,95,96,97,98,99,9A,9B,9C,9D,9E,9F,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,B0,B1,B2,B3,B4,B5,B6,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,CA,CB,CC,CD,CE,CF,D0,D1,D2,D3,D4,D5,D6,D7,D8,D9,DA,DB,DC,DD,DE,DF,E0,E1,E2,E3,E4,E5,E6,E7,E8,E9,EA,EB,EC,ED,EE,EF,F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,FA,FB,FC,FD,FE,FF,ramlsfw'
 
Sep 23 21:04:02 hansi udevd-event[31315]: '/sbin/modprobe' (stderr) 'WARNING: 
All config files need .conf: /etc/modprobe.d/arch, it will be ignored in a 
future release.' 
Sep 23 21:04:02 hansi udevd-event[31315]: '/sbin/modprobe' (stderr) 'WARNING: 
All config files need .conf: /etc/modprobe.d/crypto, it will be ignored in a 
future release.' 
Sep 23 21:04:02 hansi udevd-event[31315]: '/sbin/modprobe' returned with status 
0 
Sep 23 21:04:02 hansi udevd-event[31315]: passed 724 bytes to monitor 0x9661b90 
Sep 23 21:04:02 hansi udevd-event[31315]: passed -1 bytes to monitor 0x96511f0 
Sep 23 21:04:02 hansi udevd-event[31315]: seq 2996 exit with 0 
Sep 23 21:04:02 hansi udevd[1103]: seq 2996 cleanup, pid [31315], status 0, 0 
seconds old 
Sep 23 21:04:02 hansi udevd[1103]: seq 2997 forked, pid [31317], 'add' 'input', 
0 seconds old 
Sep 23 21:04:02 hansi udevd-event[31317]: device 0x96802a8 has devpath 
'/devices/virtual/input/input50/event6' 
Sep 23 21:04:02 hansi udevd-event[31317]: LINK 'char/13:70' 
/lib/udev/rules.d/50-udev.rules:2 
Sep 23 21:04:02 hansi udevd-event[31317]: NAME 'input/event6' 
/lib/udev/rules.d/50-udev.rules:94 
Sep 23 21:04:02 hansi udevd-event[31317]: device 0x96510b0 has devpath 
'/devices/virtual/input/input50' 
Sep 23 21:04:02 hansi udevd-event[31317]: IMPORT 'path_id 
/devices/virtual/input/input50/event6' 
/lib/udev/rules.d/60-persistent-input.rules:45 
Sep 23 21:04:02 hansi udevd-event[31317]: 'path_id 
/devices/virtual/input/input50/event6' 
Sep 23 21:04:02 hansi g15daemon[31310]: Booting plugin "LCDServer"
Sep 23 21:04:02 hansi g15daemon[31310]: Plugin "LCDServer" boot successful.
Sep 23 21:04:02 hansi udevd-event[31317]: '/lib/udev/path_id' returned with 
status 1 
Sep 23 21:04:02 hansi udevd-event[31317]: RUN 
'socket:@/org/freedesktop/hal/udev_event' /lib/udev/rules.d/90-hal.rules:2 
Sep 23 21:04:02 hansi udevd-event[31317]: create db link (input/event6 
char/13:70) 
Sep 23 21:04:02 hansi udevd-event[31317]: creating device node 
'/dev/input/event6', devnum=13:70, mode=0660, uid=0, gid=0 
Sep 23 21:04:02 hansi udevd-event[31317]: mknod(/dev/input/event6, 020660, 
(13,70)) 
Sep 23 21:04:02 hansi udevd-event[31317]: chmod(/dev/input/event6, 020660) 
Sep 23 21:04:02 hansi udevd-event[31317]: chown(/dev/input/event6, 0, 0) 
Sep 23 21:04:02 hansi udevd-event[31317]: '/dev/char/13:70' with target 
'/dev/input/event6' has the highest priority 0, create it 
Sep 23 21:04:02 hansi udevd-event[31317]: creating symlink '/dev/char/13:70' to 
'../input/event6' 
Sep 23 21:04:02 hansi udevd-event[31317]: passed 207 bytes to monitor 0x9680968 
Sep 23 21:04:02 hansi udevd-event[31317]: passed -1 bytes to monitor 0x96511f0 
Sep 23 21:04:02 hansi udevd-event[31317]: seq 2997 exit with 0 
Sep 23 21:04:02 hansi udevd[1103]: seq 2997 cleanup, pid [31317], status 0, 0 
seconds old 
Sep 23 21:04:04 hansi udevd[1103]: seq 2998 queued, 'remove' 'usb_endpoint' 
Sep 23 21:04:04 hansi udevd[1103]: seq 2998 forked, pid [31331], 'remove' 
'usb_endpoint', 0 seconds old 
Sep 23 21:04:04 hansi udevd-event[31331]: device 0x96618c8 filled with db 
symlink data '/dev/usbdev2.3_ep01' 
Sep 23 21:04:04 hansi udevd-event[31331]: RUN 
'socket:@/org/freedesktop/hal/udev_event' /lib/udev/rules.d/90-hal.rules:2 
Sep 23 21:04:04 hansi udevd-event[31331]: device 0x96803b0 has devpath 
'/devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.1' 
Sep 23 21:04:04 hansi udevd-event[31331]: device 0x9680868 has devpath 
'/devices/pci0000:00/0000:00:1d.0/usb2/2-2' 
Sep 23 21:04:04 hansi udevd-event[31331]: device 0x9680a58 has devpath 
'/devices/pci0000:00/0000:00:1d.0/usb2' 
Sep 23 21:04:04 hansi udevd-event[31331]: device 0x9661ce0 has devpath 
'/devices/pci0000:00/0000:00:1d.0' 
Sep 23 21:04:04 hansi udevd-event[31331]: device 0x967b3a0 has devpath 
'/devices/pci0000:00' 
Sep 23 21:04:04 hansi udevd-event[31331]: RUN '/etc/init.d/g15daemon udev' 
/etc/udev/rules.d/z60_g15daemon.rules:16 
Sep 23 21:04:04 hansi udevd-event[31331]: no reference left, remove 
'/dev/char/251:17' 
Sep 23 21:04:04 hansi udevd-event[31331]: removing device node 
'/dev/usbdev2.3_ep01' 
Sep 23 21:04:04 hansi udevd-event[31331]: passed 304 bytes to monitor 0x967b4e0 
Sep 23 21:04:04 hansi udevd-event[31331]: '/etc/init.d/g15daemon udev' 
Sep 23 21:04:04 hansi g15: calling g15 udev; action: remove, product 
Sep 23 21:04:05 hansi udevd[1103]: seq 2999 queued, 'remove' 'input' 
Sep 23 21:04:05 hansi udevd[1103]: seq 2999 forked, pid [31337], 'remove' 
'input', 0 seconds old 
Sep 23 21:04:05 hansi udevd-event[31337]: device 0x96803a0 filled with db 
symlink data '/dev/input/event6' 
Sep 23 21:04:05 hansi udevd-event[31337]: RUN 
'socket:@/org/freedesktop/hal/udev_event' /lib/udev/rules.d/90-hal.rules:2 
Sep 23 21:04:05 hansi udevd-event[31337]: device 0x96809d0 has devpath 
'/devices/virtual/input/input50' 
Sep 23 21:04:05 hansi udevd-event[31337]: no reference left, remove 
'/dev/char/13:70' 
Sep 23 21:04:05 hansi udevd-event[31337]: removing device node 
'/dev/input/event6' 
Sep 23 21:04:05 hansi udevd-event[31337]: passed 213 bytes to monitor 0x9661c48 
Sep 23 21:04:05 hansi udevd-event[31337]: passed -1 bytes to monitor 0x96511f0 
Sep 23 21:04:05 hansi udevd-event[31337]: seq 2999 exit with 0 
Sep 23 21:04:05 hansi udevd[1103]: seq 2999 cleanup, pid [31337], status 0, 0 
seconds old 
Sep 23 21:04:05 hansi udevd[1103]: seq 3000 queued, 'remove' 'input' 
Sep 23 21:04:05 hansi udevd[1103]: seq 3000 forked, pid [31338], 'remove' 
'input', 0 seconds old 
Sep 23 21:04:05 hansi udevd-event[31338]: RUN 
'socket:@/org/freedesktop/hal/udev_event' /lib/udev/rules.d/90-hal.rules:2 
Sep 23 21:04:05 hansi udevd-event[31338]: passed 730 bytes to monitor 0x96809a0 
Sep 23 21:04:05 hansi udevd-event[31338]: passed -1 bytes to monitor 0x96511f0 
Sep 23 21:04:05 hansi udevd-event[31338]: seq 3000 exit with 0 
Sep 23 21:04:05 hansi udevd[1103]: seq 3000 cleanup, pid [31338], status 0, 0 
seconds old 
Bus 002 Device 003: ID 046d:0a07 Logitech, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0x0a07 
  bcdDevice            0.1e
  iManufacturer           1 Logitech
  iProduct                2 Z-10 USB Speaker
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          219
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          3 G6 2006/06/21 10:55
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           43
        bInCollection           1
        baInterfaceNr( 0)       1
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID            12
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 1
        bSourceID              12
        bControlSize            2
        bmaControls( 0)      0x41
        bmaControls( 0)      0x01
          Mute
          Automatic Gain
          Bass Boost
        bmaControls( 1)      0x02
        bmaControls( 1)      0x00
          Volume
        bmaControls( 2)      0x02
        bmaControls( 2)      0x00
          Volume
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            20
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID               1
        iTerminal               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          12
        bDelay                  0 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                14
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            0 Continuous
        tLowerSamFreq        6400
        tUpperSamFreq       48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x0064  1x 100 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay              1 Decoded PCM samples
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          12
        bDelay                  0 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                14
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            0 Continuous
        tLowerSamFreq        6400
        tUpperSamFreq       48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay              1 Decoded PCM samples
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      46
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval              10
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      41
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)
Bus 002 Device 003: ID 046d:0a07 Logitech, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0x0a07 
  bcdDevice            0.1e
  iManufacturer           1 Logitech
  iProduct                2 Z-10 USB Speaker
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          219
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          3 G6 2006/06/21 10:55
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           43
        bInCollection           1
        baInterfaceNr( 0)       1
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID            12
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 1
        bSourceID              12
        bControlSize            2
        bmaControls( 0)      0x41
        bmaControls( 0)      0x01
          Mute
          Automatic Gain
          Bass Boost
        bmaControls( 1)      0x02
        bmaControls( 1)      0x00
          Volume
        bmaControls( 2)      0x02
        bmaControls( 2)      0x00
          Volume
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            20
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID               1
        iTerminal               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          12
        bDelay                  0 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                14
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            0 Continuous
        tLowerSamFreq        6400
        tUpperSamFreq       48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x0064  1x 100 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay              1 Decoded PCM samples
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          12
        bDelay                  0 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                14
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            0 Continuous
        tLowerSamFreq        6400
        tUpperSamFreq       48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay              1 Decoded PCM samples
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      46
          Report Descriptor: (length is 46)
            Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                            (null)
            Item(Local ): Usage, data= [ 0x00 ] 0
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x08 ] 8
            Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                            (null)
            Item(Local ): Usage, data= [ 0x02 ] 2
                            (null)
            Item(Global): Report ID, data= [ 0x02 ] 2
            Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                            (null)
            Item(Local ): Usage, data= [ 0x03 ] 3
                            (null)
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile 
Bitfield
            Item(Local ): Usage, data= [ 0x04 ] 4
                            (null)
            Item(Global): Report Count, data= [ 0x03 ] 3
            Item(Main  ): Feature, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile 
Bitfield
            Item(Local ): Usage, data= [ 0x06 ] 6
                            (null)
            Item(Global): Report ID, data= [ 0x03 ] 3
            Item(Global): Report Count, data= [ 0xdf 0x03 ] 991
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile 
Bitfield
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval              10
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      41
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)
Sep 23 21:39:24 hansi g15: calling g15 udev; action: "add", product 
"46d/a07/1e", devtype "usb_device", devname "/dev/bus/usb/002/006", subsystem 
"usb"
Sep 23 21:39:24 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/usbdev2.6_ep00", subsystem "usb_endpoint"
Sep 23 21:39:24 hansi g15: calling g15 udev; action: "add", product 
"46d/a07/1e", devtype "usb_interface", devname "", subsystem "usb"
Sep 23 21:39:24 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/bus/usb/002/006", subsystem "usb_device"
Sep 23 21:39:24 hansi g15: calling g15 udev; action: "add", product 
"46d/a07/1e", devtype "usb_interface", devname "", subsystem "usb"
Sep 23 21:39:25 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "", subsystem "sound"
Sep 23 21:39:25 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/usbdev2.6_ep85", subsystem "usb_endpoint"
Sep 23 21:39:25 hansi g15: calling g15 udev; action: "add", product 
"3/46d/a07/110", devtype "", devname "", subsystem "input"
Sep 23 21:39:25 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "", subsystem "hid"
Sep 23 21:39:25 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/usbdev2.6_ep83", subsystem "usb_endpoint"
Sep 23 21:39:25 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "", subsystem "hid"
Sep 23 21:39:25 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/usbdev2.6_ep03", subsystem "usb_endpoint"
Sep 23 21:39:25 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/usb/hiddev0", subsystem "usb"
Sep 23 21:39:25 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/hidraw3", subsystem "hidraw"
Sep 23 21:39:26 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/input/event2", subsystem "input"
Sep 23 21:39:26 hansi g15: calling g15 udev; action: "remove", product "", 
devtype "", devname "/dev/usb/hiddev0", subsystem "usb"
Sep 23 21:39:27 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/snd/pcmC0D0p", subsystem "sound"
Sep 23 21:39:27 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/snd/controlC0", subsystem "sound"
Sep 23 21:39:27 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/hidraw2", subsystem "hidraw"
Sep 23 21:39:28 hansi g15: calling g15 udev; action: "add", product "", devtype 
"", devname "/dev/usbdev2.6_ep01", subsystem "usb_endpoint"
Sep 23 21:39:28 hansi g15: calling g15 udev; action: "remove", product "", 
devtype "", devname "/dev/hidraw2", subsystem "hidraw"
Sep 23 21:39:29 hansi g15: calling g15 udev; action: "remove", product "", 
devtype "", devname "", subsystem "hid"
Sep 23 21:39:14 hansi g15: calling g15 udev; action: "remove", product 
"46d/a07/1e", devtype "usb_interface", devname "", subsystem "usb"
Sep 23 21:39:14 hansi g15: calling g15 udev; action: "remove", product "", 
devtype "", devname "/dev/usbdev2.5_ep03", subsystem "usb_endpoint"
Sep 23 21:39:14 hansi g15: calling g15 udev; action: "remove", product "", 
devtype "", devname "/dev/input/event2", subsystem "input"
Sep 23 21:39:14 hansi g15: calling g15 udev; action: "remove", product "", 
devtype "", devname "/dev/usbdev2.5_ep83", subsystem "usb_endpoint"
Sep 23 21:39:14 hansi g15: calling g15 udev; action: "remove", product "", 
devtype "", devname "/dev/snd/pcmC0D0p", subsystem "sound"
Sep 23 21:39:14 hansi g15: calling g15 udev; action: "remove", product "", 
devtype "", devname "/dev/usbdev2.5_ep85", subsystem "usb_endpoint"
--- g15daemon-ori	2009-09-23 22:03:41.000000000 +0200
+++ g15daemon-hansi	2009-09-23 22:02:14.000000000 +0200
@@ -134,15 +134,17 @@
 	echo "$NAME."
 	;;
   udev)
-	log "calling g15 udev; action: $ACTION, product $PRODUCT"
-	if [ "x$ACTION" = "xadd" ] ; then
+	log "calling g15 udev; action: \"$ACTION\", product \"$PRODUCT\", devtype \"$DEVTYPE\", devname \"$DEVNAME\", subsystem \"$SUBSYSTEM\""
+	if [ "x$ACTION" = "xadd" -a "$DEVTYPE" = "usb_device" -a "$SUBSYSTEM" = "usb" ] ; then
+	    # wait until /dev/inputX is registered
+	    sleep 1
 	    load_uinput || true
 	    wait_usr_mount || true
 	    # it seems udev will not release a device if userspace is still
 	    # connected
 	    is_running && ( do_stop; sleep 1 )
 	    do_start
-	elif [ "x$ACTION" = "xremove" ] ; then
+	elif [ "x$ACTION" = "xremove" -a  "$DEVTYPE" = "usb_interface" -a "$SUBSYSTEM" = "usb" ] ; then
 	    do_stop
 	else
 	    echo "unknow udev action '$ACTION'"

Reply via email to