NetBSD Problem Report #60363

From www@netbsd.org  Wed Jun 24 14:57:36 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "R13" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B0DA11A923A
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 24 Jun 2026 14:57:36 +0000 (UTC)
Message-Id: <20260624145735.A476E1A923B@mollari.NetBSD.org>
Date: Wed, 24 Jun 2026 14:57:35 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: usb(4): polling /dev/usbN never wakes up
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>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.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.