Page MenuHomeFreeBSD

preliminary usb support for fwget
ClosedPublic

Authored by jsm on Jan 25 2025, 9:50 AM.
Tags
None
Referenced Files
F125031617: D48678.id150851.diff
Sat, Aug 2, 4:01 PM
F125008750: D48678.id150990.diff
Sat, Aug 2, 8:40 AM
Unknown Object (File)
Fri, Aug 1, 6:56 PM
Unknown Object (File)
Fri, Aug 1, 5:53 AM
Unknown Object (File)
Tue, Jul 29, 7:49 AM
Unknown Object (File)
Tue, Jul 29, 3:02 AM
Unknown Object (File)
Mon, Jul 28, 7:51 PM
Unknown Object (File)
Mon, Jul 28, 3:35 PM

Details

Summary

Mostly a copy of pci subsystem support, by replacing pciconf with usbconfig and excluding hardware classes.

Test Plan

fwget usb (with a matched device attached)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jsm requested review of this revision.Jan 25 2025, 9:50 AM
jsm created this revision.

sed correct use of quantifier and use * instead of +

I was pondering this for a while -- also for other devices -- but I highly felt that usbconfig wanted some improvements first to make this a lot easier.
There are tricky bits with USB devices changing "identity" depending on quirks or other state (i.e., first show up as CD-ROM and then become a network device).

But I am all for a good start :) I'll go and look through to see if I can add a few other bits using your logic next week, if that's ok?

usr.sbin/fwget/usb/usb
60

looks like an indent problem here in Phabricator?

usr.sbin/fwget/usb/usb_ralink
6

I do not think there's anything from the Foundation or me in this file.

Perfectly fine

In D48678#1110205, @bz wrote:

I was pondering this for a while -- also for other devices -- but I highly felt that usbconfig wanted some improvements first to make this a lot easier.
There are tricky bits with USB devices changing "identity" depending on quirks or other state (i.e., first show up as CD-ROM and then become a network device).

But I am all for a good start :) I'll go and look through to see if I can add a few other bits using your logic next week, if that's ok?

Perfectly fine with me.

I'm not familar with fwget code and don't use WiFi, so can't review.

In D48678#1110205, @bz wrote:

But I am all for a good start :) I'll go and look through to see if I can add a few other bits using your logic next week, if that's ok?

Perfectly fine with me.

Not made it and likely will not the next 3-4 days. If this needs to go in, please let me know and I'll review the current version and then defer any further changes to the future.

ziaee added a subscriber: ziaee.

Manu wrote fwget so, adding him.

I think for fwget.8 you can just `%s/default pci/valid types are:
.Dv pci ,
.Dv usb ./"

(But I don't actually know the syntax for using newlines in a replace)

I'm fine with this but maybe we should expand the manpage to list subsystems

ziaee added a reviewer: manpages.
bz requested changes to this revision.Feb 22 2025, 12:41 PM

I'll try to get D48974 in.
If you fix the man page, empty line and remove the "portions of this..." from usb_ralink I hope we'll be good to go.

usr.sbin/fwget/fwget.8
26

Please don't forget to update .Dd before comitting

usr.sbin/fwget/usb/usb
42

unneeded empty line

This revision now requires changes to proceed.Feb 22 2025, 12:41 PM

I see no change in fwget output when testing using git-arc.sh patch -C D48678; cd usr.sbin/fwget; make install; fwget on todays's CURRENT .

I have an Intel AX211, I do not know if it needs the firmware from comms/iwmbt-firmware, but when I install it manually my dmesg does change.

I see no change in fwget output when testing using git-arc.sh patch -C D48678; cd usr.sbin/fwget; make install; fwget on todays's CURRENT .

I have an Intel AX211, I do not know if it needs the firmware from comms/iwmbt-firmware, but when I install it manually my dmesg does change.

This doesn't add any BT devices; I have a TODO to do so when this landed.

This revision is now accepted and ready to land.Mar 14 2025, 9:00 PM

While we've been waiting, I came up with some additional suggestions for your consideration.

usr.sbin/fwget/fwget.8
26

I'm sorry for making this kind of super annoying nit, but makewhatis will complain every time the manual database is manually compiled.

50–55

Sorry to back track on this, but (while we're waiting) I think I've got something better.

In this case, pci or usb are really command modifiers in my mind, and this also makes them render bold.

Additionally, I am hoping this shows that can use one, or both separated by a space.

71–75

Linking to the driver overview pages here would be very nice, and subsystems should be plural here.

jsm added a reviewer: ziaee.

No functional changes intended, only man page suggestions added.

This revision now requires review to proceed.May 3 2025, 3:44 PM
usr.sbin/fwget/usb/usb_ralink
33

Srcmgr looked at this a while ago. Using hex like this won't scale well.

The thought was it would be better to have the ids in a file (rather than in code). This would allow masks too. And we could reuse it for pci.

And honestly, this data is in these drivers. We need to find a way to "decorate" that data in the drivers ala devmatch.

In D48678#1143601, @imp wrote:

The thought was it would be better to have the ids in a file (rather than in code). This would allow masks too. And we could reuse it for pci.

You can use masks here too not just in an extra file. The original structure like this is from @manu who started this for graphics. At the moment I beleive this is the wrong discussion to have here. Please start a thread on hackers or somewhere if you want to rewrite it.

And honestly, this data is in these drivers. We need to find a way to "decorate" that data in the drivers ala devmatch.

And then do what with it? Not even for drm drivers you can do the automated fetch upon first boot based on the firmware request as you normally do not have networking then. But that's also something I think you need to elaborate on elsewhere.

imp requested changes to this revision.May 10 2025, 8:38 PM

You need to reply to feedback from the review.

usr.sbin/fwget/usb/usb_ralink
33

You need to at least reply to this.

This revision now requires changes to proceed.May 10 2025, 8:38 PM
markj added inline comments.
usr.sbin/fwget/usb/usb_ralink
33

To be clear, the problem with this scheme--which is pervasive in fwget--is bugs like this (which have already happened multiple times):

case 53*)
    addpkg foo ;;
...
case 531)
    addpkg bar ;;

Here, device 531 silently won't match the second case.

The solution is to reimplement all of these case statements using tables where we can easily check for ambiguous matches. flua seems like a good candidate for that.

But, that's not a problem here yet and I don't think it should block the patch: no one has prototyped a concrete alternative yet. So I don't think there's anything here that needs to change.

usr.sbin/fwget/usb/usb
2

Same, as below, can we use SPDX short form here?

usr.sbin/fwget/usb/usb_ralink
3

Can we use the ISO short form as described in style.9 and https://docs.freebsd.org/en/articles/license-guide/ ?

I think it saves loc in the tree, improves visual compatibility with standard or narrow consoles, and makes things really obvious without requiring license expertise.

Also, the - at the beginning is no longer required.

No functionel changes intended just SPDX license headers instead of full license text..

usr.sbin/fwget/usb/usb_ralink
33

So can we land this, with a future wish to refactor it with a more robust and efficient implementation that perhaps involves devmatch?

usr.sbin/fwget/usb/usb_ralink
33

Yes, you can land this; there are no wildcards here. If fwget gets re-written in flua that's a different story.

This revision was not accepted when it landed; it landed in state Needs Review.Wed, Jul 16, 5:50 PM
This revision was automatically updated to reflect the committed changes.