I have manual KVM switch that acts as USB hub between 2 boxes (monitor can handle 2 inputs). I have USB audio, keyboard and mouse attached to KVM.
Disconnect sequence:
Connect sequence:
As you may see, kernel reports devices back and Xorg picks them up. The problem is when something holds uaudio.
Kernel stops detaching sequence, doesn't start attaching sequence (when I switch KVM back) and waits indefinitely process to exit. It's hard to kill application without keyboard and mouse. Maybe, it's possible to tell kernel evict device without any waiting? Device is absent, so probably all handles are already invalid, why wait?
Disconnect sequence:
Code:
Jun 12 23:19:22 darkstar kernel: ugen0.2: <vendor 0x1a40 USB 2.0 Hub> at usbus0 (disconnected)
Jun 12 23:19:22 darkstar kernel: uhub5: at uhub3, port 8, addr 29 (disconnected)
Jun 12 23:19:22 darkstar kernel: ugen0.3: <vendor 0x0424 product 0x2514> at usbus0 (disconnected)
Jun 12 23:19:22 darkstar kernel: uhub8: at uhub5, port 1, addr 30 (disconnected)
Jun 12 23:19:22 darkstar kernel: ugen0.8: <Logitech Logitech H360 Headset> at usbus0 (disconnected)
Jun 12 23:19:22 darkstar kernel: uaudio0: at uhub8, port 1, addr 6 (disconnected)
Jun 12 23:19:23 darkstar kernel: pcm1: detached
Jun 12 23:19:23 darkstar kernel: uaudio0: detached
Jun 12 23:19:23 darkstar kernel: ugen0.4: <Logitech Logitech G15 Keyboard> at usbus0 (disconnected)
Jun 12 23:19:23 darkstar kernel: uhub9: at uhub8, port 2, addr 31 (disconnected)
Jun 12 23:19:23 darkstar kernel: ugen0.5: <vendor 0x046d Gaming Keyboard> at usbus0 (disconnected)
Jun 12 23:19:23 darkstar kernel: ukbd0: at uhub9, port 1, addr 32 (disconnected)
Jun 12 23:19:23 darkstar kernel: ukbd0: detached
Jun 12 23:19:23 darkstar kernel: uhid0: at uhub9, port 1, addr 32 (disconnected)
Jun 12 23:19:23 darkstar kernel: uhid0: detached
Jun 12 23:19:23 darkstar kernel: ugen0.6: <G15 Keyboard G15 Keyboard> at usbus0 (disconnected)
Jun 12 23:19:23 darkstar kernel: uhid1: at uhub9, port 4, addr 3 (disconnected)
Jun 12 23:19:23 darkstar kernel: uhid1: detached
Jun 12 23:19:23 darkstar kernel: ugen0.7: <Logitech USB Receiver> at usbus0 (disconnected)
Jun 12 23:19:23 darkstar kernel: ukbd1: at uhub5, port 2, addr 5 (disconnected)
Jun 12 23:19:23 darkstar kernel: ukbd1: detached
Jun 12 23:19:23 darkstar kernel: ums0: at uhub5, port 2, addr 5 (disconnected)
Jun 12 23:19:23 darkstar kernel: ums0: detached
Jun 12 23:19:23 darkstar kernel: uhid2: at uhub5, port 2, addr 5 (disconnected)
Jun 12 23:19:23 darkstar kernel: uhid2: detached
Connect sequence:
Code:
Jun 12 23:19:33 darkstar kernel: ugen0.2: <vendor 0x1a40 USB 2.0 Hub> at usbus0
Jun 12 23:19:33 darkstar kernel: uhub5: <vendor 0x1a40 USB 2.0 Hub, class 9/0, rev 2.00/1.11, addr 4> on usbus0
Jun 12 23:19:34 darkstar kernel: uhub5: 4 ports with 4 removable, self powered
Jun 12 23:19:35 darkstar kernel: ugen0.3: <vendor 0x0424 product 0x2514> at usbus0
Jun 12 23:19:35 darkstar kernel: uhub8: <vendor 0x0424 product 0x2514, class 9/0, rev 2.00/b.b3, addr 2> on usbus0
Jun 12 23:19:35 darkstar kernel: uhub8: MTT enabled
Jun 12 23:19:35 darkstar kernel: uhub8: 4 ports with 4 removable, self powered
Jun 12 23:19:36 darkstar kernel: ugen0.4: <Logitech Logitech H360 Headset> at usbus0
Jun 12 23:19:36 darkstar kernel: uaudio0 numa-domain 0 on uhub8
Jun 12 23:19:36 darkstar kernel: uaudio0: <Logitech Logitech H360 Headset, class 0/0, rev 2.00/1.00, addr 7> on usbus0
Jun 12 23:19:36 darkstar kernel: uaudio0: Play: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Play: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Play: 40000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Play: 32000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Play: 24000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Play: 22050 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Play: 16000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Play: 11025 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Play: 8000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Record: 48000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Record: 44100 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Record: 40000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Record: 32000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Record: 24000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Record: 22050 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Record: 16000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Record: 11025 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: Record: 8000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
Jun 12 23:19:36 darkstar kernel: uaudio0: No MIDI sequencer.
Jun 12 23:19:36 darkstar kernel: pcm1: <USB audio> numa-domain 0 on uaudio0
Jun 12 23:19:36 darkstar kernel: uaudio0: HID volume keys found.
Jun 12 23:19:37 darkstar kernel: ugen0.5: <Logitech Logitech G15 Keyboard> at usbus0
Jun 12 23:19:37 darkstar kernel: uhub9: <Logitech Logitech G15 Keyboard, class 9/0, rev 1.10/1.03, addr 1> on usbus0
Jun 12 23:19:37 darkstar kernel: uhub9: 4 ports with 2 removable, bus powered
Jun 12 23:19:38 darkstar kernel: ugen0.6: <vendor 0x046d Gaming Keyboard> at usbus0
Jun 12 23:19:38 darkstar kernel: ukbd0 numa-domain 0 on uhub9
Jun 12 23:19:38 darkstar kernel: ukbd0: <vendor 0x046d Gaming Keyboard, class 0/0, rev 2.00/1.90, addr 14> on usbus0
Jun 12 23:19:38 darkstar kernel: kbd2 at ukbd0
Jun 12 23:19:38 darkstar kernel: uhid0 numa-domain 0 on uhub9
Jun 12 23:19:38 darkstar kernel: uhid0: <vendor 0x046d Gaming Keyboard, class 0/0, rev 2.00/1.90, addr 14> on usbus0
Jun 12 23:19:39 darkstar kernel: ugen0.7: <G15 Keyboard G15 Keyboard> at usbus0
Jun 12 23:19:39 darkstar kernel: hid_get_item: Number of items(991) truncated to 255
Jun 12 23:19:39 darkstar kernel: hid_get_item: Number of items(991) truncated to 255
Jun 12 23:19:39 darkstar kernel: uhid1 numa-domain 0 on uhub9
Jun 12 23:19:39 darkstar kernel: uhid1: <G15 Keyboard G15 Keyboard, class 0/0, rev 2.00/1.03, addr 15> on usbus0
Jun 12 23:19:39 darkstar kernel: hid_get_item: Number of items(991) truncated to 255
Jun 12 23:19:39 darkstar last message repeated 2 times
Jun 12 23:19:39 darkstar kernel: ugen0.8: <Logitech USB Receiver> at usbus0
Jun 12 23:19:39 darkstar kernel: ukbd1 numa-domain 0 on uhub5
Jun 12 23:19:39 darkstar kernel: ukbd1: <Logitech USB Receiver, class 0/0, rev 2.00/12.03, addr 10> on usbus0
Jun 12 23:19:39 darkstar kernel: kbd3 at ukbd1
Jun 12 23:19:39 darkstar kernel: ums0 numa-domain 0 on uhub5
Jun 12 23:19:39 darkstar kernel: ums0: <Logitech USB Receiver, class 0/0, rev 2.00/12.03, addr 10> on usbus0
Jun 12 23:19:39 darkstar kernel: ums0: 16 buttons and [XYZT] coordinates ID=2
Jun 12 23:19:39 darkstar kernel: uhid2 numa-domain 0 on uhub5
Jun 12 23:19:39 darkstar kernel: uhid2: <Logitech USB Receiver, class 0/0, rev 2.00/12.03, addr 10> on usbus0
As you may see, kernel reports devices back and Xorg picks them up. The problem is when something holds uaudio.
Code:
Jun 12 23:14:02 darkstar kernel: uaudio0: at uhub8, port 1, addr 10 (disconnected)
Jun 12 23:14:02 darkstar kernel: pcm1: unregister: channel pcm1:virtual:dsp1.vp0 busy (pid 1399)
Jun 12 23:14:02 darkstar kernel: pcm1: Waiting for sound application to exit!
Jun 12 23:14:04 darkstar kernel: pcm1: unregister: channel pcm1:virtual:dsp1.vp0 busy (pid 1399)
Jun 12 23:14:04 darkstar kernel: pcm1: Waiting for sound application to exit!
Jun 12 23:14:06 darkstar kernel: pcm1: unregister: channel pcm1:virtual:dsp1.vp0 busy (pid 1399)
Jun 12 23:14:06 darkstar kernel: pcm1: Waiting for sound application to exit!
Jun 12 23:14:08 darkstar kernel: pcm1: unregister: channel pcm1:virtual:dsp1.vp0 busy (pid 1399)
Jun 12 23:14:08 darkstar kernel: pcm1: Waiting for sound application to exit!
Jun 12 23:14:10 darkstar kernel: pcm1: unregister: channel pcm1:virtual:dsp1.vp0 busy (pid 1399)
Jun 12 23:14:10 darkstar kernel: pcm1: Waiting for sound application to exit!
Kernel stops detaching sequence, doesn't start attaching sequence (when I switch KVM back) and waits indefinitely process to exit. It's hard to kill application without keyboard and mouse. Maybe, it's possible to tell kernel evict device without any waiting? Device is absent, so probably all handles are already invalid, why wait?