From owner-freebsd-usb@freebsd.org Fri Jun 26 15:56:27 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 5F57B35B188 for ; Fri, 26 Jun 2020 15:56:27 +0000 (UTC) (envelope-from tomek@cedro.info) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49thMG2GRmz4mp6 for ; Fri, 26 Jun 2020 15:56:26 +0000 (UTC) (envelope-from tomek@cedro.info) Received: by mail-wr1-x442.google.com with SMTP id g18so10027603wrm.2 for ; Fri, 26 Jun 2020 08:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cedro.info; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XgwSaUuuvMWrw2dxzjGB83KWlvnvPtGaK2UkK6Pgw3A=; b=DCQv89TJCllxzfzRHu7Np9KYeRx11BVm3OOjE/dwDEQeTj4BYrY66B+DXpHAPFGMuS tI+QNcBt7P4WdU96exBLHop+TddTSfuwfuf/b4HNjOxOz/DY4zkFLuM8f6yGrWaH8VwK LfJbyxLRfFh1O14PlIGcupfyZ5Z9Ymgy9u9Vr2SesAQQxLrRxsiSg9JJrclCQsON4Yu1 UQzxPiIX9upeebb0HPnaZNM0w9xxTQtXn10kX0hHXy2yMPSWrlyzY47+6j3RyDkPSLDL I0Lysnes5j7L/qN31XMo7XsRKla/kJv7+W/AtF/LjrGMtwG/KSodL/9eELRXgEjaPrlR 8gyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XgwSaUuuvMWrw2dxzjGB83KWlvnvPtGaK2UkK6Pgw3A=; b=Jq+bNGz/hZ24P6BLCmhNJP16AUIiXOE+nrptqh2prU6bUqoAHIbfDf0LJN6XNENTYs R+gAfINTy7RQtQqmow4uMvQ/fKYW78dPek3PGEAaSQ+KsMZS3kNmwyjs0d9NTm40NNp7 v+nUs9T0Sn29g0co53OzpY+SwbDglE4tYl8+5rHKjCP03V9ZLvdUKT8iHDjhvV55Ueac f0pfnJVNMv3zjlhwvCVwfybX330NZtfeeTexUU2lpfchTnUI7gJF5YTgLC0/eT1gv3I5 bMWX6KYEoJqqI7T8wbyegchuN3G0yw6n9vwTo5DaqaXyf70tFeKpJjwuoUsufV25o1jO nolw== X-Gm-Message-State: AOAM530dVqYIFg6hXIXl57z4tta3saSAkT7ZjzsUYxs2a6/WxZvyVBvy L/SV5kVI0inUv3/MmbbYCg3T8g2FB69ltGIKLreiDw== X-Google-Smtp-Source: ABdhPJx3DdSob33M+xH1zxNJwuIs1iqBqSGUKNu7cWNGWMt55Y11wVLbJTHkoqcO54rQ83ywjzAdprBXgOG1TZB3zEw= X-Received: by 2002:a5d:6907:: with SMTP id t7mr4421669wru.329.1593186985024; Fri, 26 Jun 2020 08:56:25 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <20200626172851.872f3a08fa6e632666683230@magnetkern.de> From: Tomasz CEDRO Date: Fri, 26 Jun 2020 17:56:14 +0200 Message-ID: Subject: Re: USB reset fails when using a LimeSDR Mini on FreeBSD To: Jan Behrens Cc: Hans Petter Selasky , CeDeROM , "freebsd-usb@FreeBSD.org" X-Rspamd-Queue-Id: 49thMG2GRmz4mp6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cedro.info header.s=google header.b=DCQv89TJ; dmarc=none; spf=none (mx1.freebsd.org: domain of tomek@cedro.info has no SPF policy when checking 2a00:1450:4864:20::442) smtp.mailfrom=tomek@cedro.info X-Spamd-Result: default: False [-2.40 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[cedro.info:s=google]; NEURAL_HAM_MEDIUM(-0.98)[-0.982]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.03)[-1.029]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-usb@freebsd.org]; DMARC_NA(0.00)[cedro.info]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[cedro.info:+]; NEURAL_HAM_SHORT(-0.09)[-0.089]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::442:from]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.33 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: Fri, 26 Jun 2020 15:56:27 -0000 pt., 26 cze 2020, 17:28 u=C5=BCytkownik Jan Behrens napisa=C5=82: > Does this mean that depending on the device, it will either be a > no-operation or a re-enumeration, and in the latter case, root > privileges are required, otherwise not? > > Or did you mean that if you are non-root, it will/should always be a > no-operation? > I guess that root is required for some administrative operations like port reset etc that are not really possible to achieve even through /dev/usb* permissions. When in trouble always try to test at root especially when working with hardware. That may pinpoint the permissions issuses (not only /dev/usb* permissions). What I don't understand is that the Lime Suite SoapySDR module seems to > work fine on Linux and other operating systems but makes trouble with > FreeBSD. Is it a FreeBSD specific thing that libusb_reset_device() > fails if called as non-root? > Linux as well as other operating systems usually uses dirty and quick hacks. FreeBSD treats standards seriously and usually does not have these kind of dirty hacks. This is the first difference. Second difference is that FreeBSD has its own implementation of LibUSB. There may be a problem here bu that would require detailed investigation and proofs. Very nice exercise to perform :- I could give recommendation to the Lime Suite developers to remove the > libusb_reset_device() call on FreeBSD systems if it is not neccessary. > However, I would like to understand why it is called and what's its > usual purpose, and if there are side effects when removing the call, or > whether the call should/could be replaced by a different call that > "only" requires device privileges. Also: Why does this work on Linux > but fails on FreeBSD? Is the API differently defined? Very good approach to understand what is the problem and fix it rarher than using dirty hacks just to make things work :-) What particular LimeSDR device do you have? Is it expensive? Can you share a spare one for testing? Can you acquire access to hardware USB sniffer? Best regards :-) Tomek -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info