If you examine dmesg's output, you can see exactly when it's ringing the bell, by grepping for the ASCII BEL character
$ dmesg | grep -C1 $'\a'
[ 5.706427] usb 1-2: Manufacturer: HD WebCam
[ 5.706434] usb 1-2: SerialNumber: NC2141103Q533020AALM03
[ 5.798439] Unsafe core_pattern used with suid_dumpable=2. Pipe handler or fully qualified core dump path required.
[13843.531106] usb 1-2: Manufacturer: HD WebCam
[13843.531115] usb 1-2: SerialNumber: NC2141103Q533020AALM03
[13843.546586] uvcvideo: Found UVC 1.00 device HD WebCam (0bda:57cf)
Interestingly, the bell-ringing appears to be happening halfway through initialising the webcam. We can check exactly where in the line the BEL is being printed by piping through od:
$ dmesg | grep $'\a' | head -n 1 | od -c
0000000 [ 5 . 7 0 6 4 3 4 ] u
0000020 s b 1 - 2 : S e r i a l N u
0000040 m b e r : \a N C 2 1 4 1 1 0 3
0000060 Q 5 3 3 0 2 0 A A L M 0 3 \n
The BEL is represented here as
\a, and it's being printed just before the serial number (
SerialNumber: ␇NC214...). It seems unlikely that dmesg would insert a BEL halfway through a line, so maybe it's the kernel that's logging it.
Let's check the source code. Maybe the USB driver is printing a bell when it logs the serial number. We can use livegrep to quickly search the Linux 4.12 source, and find that the relevant file is likely to be
drivers/usb/core/hub.c. Then, we can go back to the Linux 3.10.18 source by using Elixir, and find the relevant function:
static void announce_device(struct usb_device *udev)
dev_info(&udev->dev, "New USB device found, idVendor=%04x, idProduct=%04x\n",
"New USB device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
show_string(udev, "Product", udev->product);
show_string(udev, "Manufacturer", udev->manufacturer);
show_string(udev, "SerialNumber", udev->serial);
show_string is a very simple function, defined just above
announce_device, that pretty much just prints its arguments separated by a colon and a space:
static void show_string(struct usb_device *udev, char *id, char *string)
dev_info(&udev->dev, "%s: %s\n", id, string);
So it's not the kernel that's adding the bell either.
What's the USB device's serial number?
We can check with lsusb:
$ lsusb -vd 0bda:57cf | grep iSerial
iSerial 2 NC2141103Q533020AALM03
OK, now let's pipe it through od:
$ lsusb -vd 0bda:57cf | grep iSerial | od -c
0000000 i S e r i a l
0000020 2 \a N C 2
0000040 1 4 1 1 0 3 Q 5 3 3 0 2 0 A A L
0000060 M 0 3 \n
which suggests that, in fact, the webcam's serial number contains an ASCII BEL.