NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/60363: usb(4): polling /dev/usbN never wakes up



>Number:         60363
>Category:       kern
>Synopsis:       usb(4): polling /dev/usbN never wakes up
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 24 15:00:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1.6, 1.5...
>Organization:
The NetUSB Foundadevice, Inc.
>Environment:
>Description:

	The usb(4) man page claims that /dev/usbN can be polled for
	notifications of device connection and disconnection:

     The /dev/usbN can be opened and a few operations can be performed on it.
     The poll(2) system call will say that I/O is possible on the controller
     device when a USB device has been connected or disconnected to the bus.

	But this is not true.  It only works for /dev/usb (minor=0),
	not for /dev/usbN (minor=N>0), and that's been the case since
	mid-1999.

	https://mail-index.NetBSD.org/tech-kern/2026/06/24/msg031105.html

>How-To-Repeat:

	man 4 usb

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <poll.h>
#include <dev/usb/usb.h>
#include <err.h>

int
main(void)
{
	int fd = open("/dev/usb0", O_RDONLY, 0);
	if (fd < 0)
		err(EXIT_FAILURE, "open /dev/usb0");

	struct pollfd fds[] = { {fd, POLLRDNORM|POLLRDBAND|POLLIN, 0 } };
	int r = poll(fds, 1, INFTIM);
	fprintf(stderr, "return %d\n", r);

	close(fd);
}

>Fix:

	Either provide the functionality, or fix the man page.




Home | Main Index | Thread Index | Old Index