From owner-freebsd-usb@freebsd.org Thu Jul 2 08:47:45 2020 Return-Path: Delivered-To: freebsd-usb@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91AE834DDE0 for ; Thu, 2 Jul 2020 08:47:45 +0000 (UTC) (envelope-from jbe-mlist@magnetkern.de) Received: from sapphire.magnetkern.de (sapphire.magnetkern.de [185.228.139.199]) by mx1.freebsd.org (Postfix) with ESMTP id 49yBYr6HSWz4WJh for ; Thu, 2 Jul 2020 08:47:44 +0000 (UTC) (envelope-from jbe-mlist@magnetkern.de) Received: from titanium (p5dd45c70.dip0.t-ipconnect.de [93.212.92.112]) by sapphire.magnetkern.de (Postfix) with ESMTPSA id D668B1BF7; Thu, 2 Jul 2020 08:47:43 +0000 (UTC) Date: Thu, 2 Jul 2020 10:47:43 +0200 From: Jan Behrens To: Hans Petter Selasky Cc: "freebsd-usb@FreeBSD.org" Subject: Re: USB reset fails when using a LimeSDR Mini on FreeBSD Message-Id: <20200702104743.223e98c325806025704703f2@magnetkern.de> In-Reply-To: <97c8fd11-9200-dff7-4c68-b0b80cc44871@selasky.org> References: <20200625121052.e9f7e7cbeb68fad264ec80a9@magnetkern.de> <20200625200849.6af81489a80c2f97d4f89ee6@magnetkern.de> <20200625224522.44d6584465cb6e20d17be320@magnetkern.de> <0ec3e5a3-7f31-d1cd-6862-6066c431aa80@selasky.org> <20200626135151.e5542cf97fad213c4ad661f2@magnetkern.de> <5c0729f9-9e98-52f7-a5cb-6c5dfd2287a3@selasky.org> <20200626172851.872f3a08fa6e632666683230@magnetkern.de> <20200627144419.f14371695d9b62ea99106c4a@magnetkern.de> <20200627173604.7f7b7777140e66dbad812fc7@magnetkern.de> <20200627180420.4b8012fb@ernst.home> <20200702103523.adb0566bcc7b6e354905a8a5@magnetkern.de> <97c8fd11-9200-dff7-4c68-b0b80cc44871@selasky.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49yBYr6HSWz4WJh X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jbe-mlist@magnetkern.de designates 185.228.139.199 as permitted sender) smtp.mailfrom=jbe-mlist@magnetkern.de X-Spamd-Result: default: False [-1.67 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[magnetkern.de]; NEURAL_HAM_LONG(-0.99)[-0.994]; NEURAL_SPAM_SHORT(0.04)[0.038]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_MEDIUM(-1.01)[-1.010]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:197540, ipnet:185.228.136.0/22, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[93.212.92.112:received] X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2020 08:47:45 -0000 On Thu, 2 Jul 2020 10:41:42 +0200 Hans Petter Selasky wrote: > On 2020-07-02 10:35, Jan Behrens wrote: > > Thus Linux definitely behaves differently here. My question is: Can > > and/or should FreeBSD be fixed to allow libusb_reset_device() as a user > > or should a driver library be fixed to not use that call. > > This is an architectural problem. USB devices may have interfaces with > independent drivers attached. If one USB interface driver is running as > root and another USB interface driver is running as non-root, it doesn't > make sense that the non-root device driver should be able to affect the > root-one. But wouldn't both drivers require access to the entries in /dev ? Thus not every user could mess with any USB device, or do I get it wrong? > Your LimeSDR device appears to be very simple, having just one > USB device driver attaching to it. Just imagine some web-page trying to > reset your USB device, just because it can! Yes, USB is also exposed to > firefox nowadays :-) My webbrowser runs as different user than the programs that get access to emit radio emissions on my behalf. > > What we could do is to add a sysctl which controls the behaviour for > this specific case. Would that be of any use to you? You mean allowing users to reset USB devices? Only those which the users have access to on the /dev filesystem? Or all devices? > > --HPS > Regards, Jan