Page MenuHomeFreeBSD

fwget: rewrite in lua, attempt #1
Needs ReviewPublic

Authored by bz on Sep 1 2025, 6:56 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 11, 8:05 PM
Unknown Object (File)
Sat, Oct 11, 8:05 PM
Unknown Object (File)
Sat, Oct 11, 11:08 AM
Unknown Object (File)
Fri, Oct 10, 7:44 AM
Unknown Object (File)
Sun, Oct 5, 3:14 AM
Unknown Object (File)
Sat, Oct 4, 4:45 AM
Unknown Object (File)
Thu, Sep 25, 7:35 AM
Unknown Object (File)
Wed, Sep 24, 2:58 PM
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

For now it tries to match -n -q -v behaviour from the shell script
version where possible. -v has minor alterations given we no longer
have individual shell scripts.

Added -D directory which is helpful while working on fwget to point it
to where to find the firmware table files given I was tired of env.

Added -d which outputs debug warnings which would otherwise be silent
like overlapping/duplicate firmware table entries (some may be false
positives); no primary key found; invalid lines, duplicate selectors, ...

The firmware table input files are modelled after the output of their
tool (pciconf -l or usbconfig -l dump_device_desc) and use the same
selectors. The "vendor id" is set to tbe the mandatory selector for
both busses. The firmware file(s) information is appended.

Selection starts on the entries with the most selectors (more
specific if I got the iterator right).

For now I kept the firmware tables split into individual files as
that may help maintainance (especially if auto-generated).

I should also help to sort certain things initially (now):

(a) pci wireless devices do not match subclass, and qca and mediatek

need individual checks for class as they use "old" or "misc" as
class for some (all?) chipsets.

(b) for pci video I currently modelled the files after the shell

scripts replacing globbing with masks BUT I also added the individual
records I extracted from the drivers.  There are some which I do not
fully understand how they fit together and others in the Intel case
which are entirely unhandled.  I left them for now to be clarified
or cleaned up.  Someone should look over them.  if we fix the current
shell version I'll try to keep this updated too.
The masked device entries likely should vanish at the end?

(c) The real motiviation for cleaning it up was so that I could add the

USB Bluetooth bits for Intel and Realtek and prepared qca and brcm
but the latter two need ports work first.
Test Plan

I run it across some of my systems (one including a lot of
wifi devices) before some last-minute changes.

I tried various command line combinations and tried to catch
bits but hey...

The only hard coded consumer in the tree seems to be the installer.

I am just putting this out here so that it's out.

The lua script or the formats chosen may be utterly useless.

I am very well aware of optimizations on how to build the
internal tables and do way more effective matching at the
end of the weekend but before I (or someone else) go(es)
there, let's have a look.

This is my first own lua scrpit ever and it's written like
perl but it was a fun experience beginning to learn yet
another language.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 66745
Build 63628: arc lint + arc unit

Event Timeline

bz requested review of this revision.Sep 1 2025, 6:56 PM

Oh and I have not style.9 cleaned it up yet. Where's the fun it that... So please don't go after that just yet.

I believe I'll add the BT bits in as a shell version for 15.0 as this is likely 16-CURRENT first?