Commit Graph

15 Commits

Author SHA1 Message Date
Warner Losh
4a82f36851 Add in a missing newline
In the conversion, the newline got stripped. It worked fine when there
was only one module, but not when there are many. Add back the missing
newline.

Approved by: re@ (kib)
PR: 230868
Differential Revision: https://reviews.freebsd.org/D16895
2018-08-25 15:47:52 +00:00
Warner Losh
ce1ba01c8a When trying to match the nomatch event passed to us, attempt to look
up the device described by the nomatch event in the device tree. If we
find it, then if the device is marked as have already attached to a
device once, then ignore the device.

This keeps us from reloading the device driver when it has just been
manually unloaded. All devies that have had a driver attach to them at
least once no longer participate in pnp-based autoloading.

Differential Revision: https://reviews.freebsd.org/D16735
2018-08-23 05:06:22 +00:00
Warner Losh
d36967bd2b Add a new device flag: DF_ATTACHED_ONCE
This flag is set once the device has been successfully attached. When
set, it inhibits devmatch from trying to match the device. This in
turn allows kldunload to work as expected. Prior to the change, the
driver would immediately reload because devmatch had no notion that
the driver had once been attached, and therefore shouldn't participate
in further matching.

Differential Revision: https://reviews.freebsd.org/D16735
2018-08-23 05:06:16 +00:00
Warner Losh
84725a5fd0 Remove sorting of matches and print all the matches as we find them.
This backs out the hack we added in r329458. Now that we can freeze /
thaw probing, this is a much better solution to that problem. Revert
to simply printing the results as we find them, and relying on an
external sort | uniq to clean up the list.

Differential Revision: https://reviews.freebsd.org/D16735
2018-08-23 05:06:11 +00:00
John Baldwin
44a230cd92 Exit with an error if a linker hints file can't be found.
Continuing with a NULL hints variable just triggers a segfault later on.
The other error cases in this function all exit for an error rather than
warning.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D15579
2018-06-14 22:31:30 +00:00
Warner Losh
c798d98e75 More verbose output. 2018-02-20 05:35:00 +00:00
Warner Losh
bbd4852a9b Print more info for -v runs and temp hack for usb vs uhub
Despite best efforts to regularize, there's a few tables in the system
that still report they are for bus usb when they are really for bus
uhub (where usb devices attach). Add a temporary workaround for this
until these places have been eliminated (likely my fault).

Second, when running verbose, describe what we're doing when
searching. This output can be quite long, but says exactly what's
going on (this output is to stdout, so it's useless for scripting).
2018-02-18 23:16:16 +00:00
Hans Petter Selasky
201c73815f Fix USB driver matching in devmatch(8).
Multiple drivers can match on the same USB device and the order of loading
decides which driver gets the device. Use the supplied mask value as an
indication of priority, so that vendor specific device drivers are loaded
before more generic ones.

Sponsored by:	Mellanox Technologies
2018-02-17 14:34:47 +00:00
Warner Losh
3fa2c0489b Implement --hints to read hints file directly
In testing, it's often useful to copy a few files into a directory and
kldxref them to ensure that particular cases are handled correctly.
Add --hints (-h) to facilitate this testing and enable future
automated testing.

Sponsored by: Netflix
2018-02-17 06:57:43 +00:00
Warner Losh
d38a8a7aa5 Add option to parse NOMATCH event and suggest modules to load
Add --nomatch/-p to search for individual drivers based on a NOMATCH
event from devd.

Submitted by: hps (earlier version)
Sponsored by: Netflix
2018-02-17 06:57:34 +00:00
Warner Losh
5e0195c8f5 Tweak the 'I' flagged value
'I' was omitting 'zero' values. This is not quite correct, and was put
in as a hack but not documented. Remove it. If we find what the hack
was really needed for, we'll either fix the need for it, or invent a
new flagged value type.

Submitted by: hps@
Sponsored by: Netflix
2018-02-17 06:57:30 +00:00
Warner Losh
b9c40202d8 Implement 'T' field matching.
Implement 'T' field matching. This is needed to prevent false
positives. However, it's not general enough. It only handles one field
and there's a ton of edge cases even with that it likely wouldn't
handle. To do it more generally and also eliminate a lot of the
hackiness that's in this program now, we'd need to creating
directories for lookups ala awk, pearl, python, etc. It appears to be
sufficient, though, to get my keyboard loaded on boot.

Sponsored by: Netflix
2018-02-17 06:57:25 +00:00
Warner Losh
a164a319eb Warn when we encounter unknown PNP field specifiers.
The 'T' field went unimplemented for months due to a lack of warning.
Add a warnings to detect mistakes sooner.

Sponsored by: Netflix
2018-02-17 06:57:12 +00:00
Conrad Meyer
487340b004 devmatch.8: Link to MODULE_PNP_INFO(9)
Sponsored by:	Dell EMC Isilon
2018-02-12 22:43:47 +00:00
Warner Losh
590682b6e6 Move devmatch to sbin from usr/sbin.
Since we want to use devmatch in context before a split /,/usr system
has mounted /usr, move devmatch to /sbin.

Sponsored by: Netflix
2018-02-12 14:44:21 +00:00