Re: pyserial.tools.list_port improvement for FreeBSD
Date: Tue, 22 Oct 2024 19:03:15 UTC
On Tue, Oct 22, 2024 at 8:47 PM 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=10] add path 'usb/*' mode 0660 group operator % grep ruleset /etc/rc.conf devfs_system_ruleset="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=0 md=HOST spd=FULL (12Mbps) pwr=ON (300mA) % ls -al /dev/usb/0.7* crw-rw---- 1 root operator 0x24a 22 paź 20:50 /dev/usb/0.7.0 crw-rw---- 1 root operator 0x24e 22 paź 20:50 /dev/usb/0.7.1 crw-rw---- 1 root operator 0x250 22 paź 20:50 /dev/usb/0.7.2 crw-rw---- 1 root operator 0x252 22 paź 20:50 /dev/usb/0.7.3 crw-rw---- 1 root operator 0x253 22 paź 20:50 /dev/usb/0.7.4 crw-rw---- 1 root operator 0x280 22 paź 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 -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info