Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2024 21:03:15 +0200
From:      Tomek CEDRO <tomek@cedro.info>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        hackers@freebsd.org
Subject:   Re: pyserial.tools.list_port improvement for FreeBSD
Message-ID:  <CAFYkXj=E=wg9q5ZW81rVLMs90hxdazRuc1j4awuCAC0Dgmjx0g@mail.gmail.com>
In-Reply-To: <202410221847.49MIlXEs014246@critter.freebsd.dk>
References:  <202410210954.49L9s9sD076618@critter.freebsd.dk> <203ADA8C-A4ED-4849-B89D-6D18664D67D0@webweaving.org> <CAFYkXjmzAsxLiRZNM1=A37hXKHrDRud6u0R-odxosmCg0oPMcg@mail.gmail.com> <202410221118.49MBIRSj009090@critter.freebsd.dk> <CAFYkXjk2XUc=N49=XN%2B=VA_G%2BVC4KkYUTdE4G=BQDKD86esUHg@mail.gmail.com> <202410221847.49MIlXEs014246@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 22, 2024 at 8:47=E2=80=AFPM Poul-Henning Kamp <phk@phk.freebsd.=
dk> wrote:
>
> --------
> Tomek CEDRO writes:
>
> > On the "desc:" in place of ugen I would put "Silicon Labs CP2102N USB
> > to UART Bridge Controller" as the ugen is in the HWID/LOCATION or
> > there is a reason to put ugen there? :-)
>
> The strings from the USB descriptors are unfortunately not available
> from devinfo(8) and usbconfig(8) needs root-privs to reveal them.
>
> I vaguely recall that the strings are not in devinfo (aka: "newbus")
> due to valid security concerns about unsafe "strings" like these,
> but I cannot find any evidence of/from that ancient discussion just
> now.
>
> I do find it inconsistent, that usbconfig(8) cannot function in
> read-only mode for plain users, given that the information it would
> reveal is already available for all from dmesg, but this might not
> be policy but merely an sideeffect of the implementation.

Hmm, I am running usbconfig on non-root user in the operator group
with some devfs.rules tweak that enables operator group members to
have full access to usb devices with no suid and I can see these
strings :-) I did put a pkg-message when creating OpenOCD port and it
seems to work fine for a long time :-)

% whoami
cederom

% cat /etc/devfs.rules
[system=3D10]
add path 'usb/*' mode 0660 group operator

% grep ruleset /etc/rc.conf
devfs_system_ruleset=3D"localrules"

% whereis usbconfig
usbconfig: /usr/sbin/usbconfig /usr/share/man/man8/usbconfig.8.gz
/usr/src/usr.sbin/usbconfig

% ls -al /usr/sbin/usbconfig
-r-xr-xr-x  1 root  wheel  29504  4 lip 20:31 /usr/sbin/usbconfig

% usbconfig
(..)
ugen0.7: <STMicroelectronics STM32 STLink> at usbus0, cfg=3D0 md=3DHOST
spd=3DFULL (12Mbps) pwr=3DON (300mA)

% ls -al /dev/usb/0.7*
crw-rw----  1 root  operator  0x24a 22 pa=C5=BA 20:50 /dev/usb/0.7.0
crw-rw----  1 root  operator  0x24e 22 pa=C5=BA 20:50 /dev/usb/0.7.1
crw-rw----  1 root  operator  0x250 22 pa=C5=BA 20:50 /dev/usb/0.7.2
crw-rw----  1 root  operator  0x252 22 pa=C5=BA 20:50 /dev/usb/0.7.3
crw-rw----  1 root  operator  0x253 22 pa=C5=BA 20:50 /dev/usb/0.7.4
crw-rw----  1 root  operator  0x280 22 pa=C5=BA 20:50 /dev/usb/0.7.5

Can you please verify? Maybe when this string is not available you can
put ugen0.7 instead? :-)

Thank you :-)
Tomek

--=20
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFYkXj=E=wg9q5ZW81rVLMs90hxdazRuc1j4awuCAC0Dgmjx0g>