Commit Graph

863 Commits

Author SHA1 Message Date
Greg Kroah-Hartman
54dcbfc0e8 lsusb.c: change TODO into a fixme in do_dualspeed()
It's not broken, just something else we could be displaying if someone
wants to add support for it.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-16 17:02:07 +01:00
Greg Kroah-Hartman
c6e9bcfcdf lsusb: change FIXME for bmEthernetStatistics into a TODO
Document the bits for bmEthernetStatistics if someone wants to do this
in the future.  It's not a FIXME, but rather a TODO if someone has a
device they can test this with.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-16 17:00:53 +01:00
Greg Kroah-Hartman
87639bc6f1 lsusb: remove FIXME about wireless usb device
There is no such thing as Wireless USB anymore, it's long gone and
obsolete and never will be seen.  So remove the FIXME comment and just
state it as such.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-16 16:16:13 +01:00
Greg Kroah-Hartman
e393a76c37 lsusb: turn a FIXME comment for dump_comm_descriptor() into something real
In dump_comm_descriptor() we have a FIXME that we aren't going to deal
with here anytime soon.  If people show up with a device that has
additional descriptors, we'll be glad to add them.  But until that
happens, just comment it as such as we aren't going to change the code
any time soon.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-16 16:14:22 +01:00
Greg Kroah-Hartman
ddcab4c53b Remove commented out code in usbreset.c and list.h and container_of.h
Gets rid of a CodeQL warning that it might be "confusing" to have
commented out code in a file.

Kids these days, surely they must use an editor that shows comments in
different colors so that they notice this isn't really going to do
anything...

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-16 16:09:35 +01:00
Greg Kroah-Hartman
79a0b233a3
Merge pull request #211 from evelikov/codeql-tidy
ci: codeql ignore meson generated files, et al
2024-11-16 11:48:01 +01:00
Enrico Joerns
e9282203fe ci/codeql: use filter-sarif to filter meson-private
There is a severe number of false-positive in code scanning caused by
inspecting meson-internal test files like
'build/meson-private/tmpzb46osmq/testfile.c'.

As a workaround, use the 'filter-sarif' action to filter out these
results before uploading the SARIF (Static Analysis Results Interchange
Format).

This PR was inspired by https://github.com/rauc/rauc/pull/1346 and the
example from https://github.com/advanced-security/filter-sarif.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
[Emil: port from rauc, use checksums for actions]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-11-16 10:33:09 +00:00
Emil Velikov
2c488b6e19 ci: stop manually creating build/
There's no need to manually create and cd into the build directory,
since meson knows how to handle that.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-11-16 10:26:04 +00:00
Lucas De Marchi
a25e93188b ci: Fix debian/ubuntu installation
Make sure we are running in non-interactive mode and that we don't get
blocked on tzdata update.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
[Emil: port from kmod]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-11-16 10:26:04 +00:00
Greg Kroah-Hartman
807d0cce0b
Merge pull request #209 from tsundre/improve-usb2-extension-devcap
lsusb: improve usb2 device capability descriptor
2024-11-16 08:27:10 +01:00
Torleiv Sundre
5c02e04ebc lsusb: improve usb2 device capability descriptor
Fix the following issues with the usb2 device capability descriptor
dump:

Currently, the BESL values claim to be in microseconds, but are actually
the raw, unshifted values from the descriptor. Use a lookup table for
the BESL values, based on Table X-X1 from "Errata for USB 2.0 ECN: Link
Power Management (LPM) - 7/2007" to display the actual microsecond
values.

Currently, the BESL values are displayed at the same indentation level
as bmAttributes, even though they are fields in bmAttributes. Adjust
indentation to align all fields of bmAttributes.

Change "BESL value" to "Baseline BESL value", to reflect the actual
names of the field.

Remove two unnecessary line breaks.

Before change:
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x0000f41e
      BESL Link Power Management (LPM) Supported
    BESL value     1024 us
    Deep BESL value    61440 us

After change:
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x0000f41e
      BESL Link Power Management (LPM) Supported
      Baseline BESL value    400 us
      Deep BESL value      10000 us

Signed-off-by: Torleiv Sundre <torleiv@huddly.com>
2024-11-16 08:15:21 +01:00
Greg Kroah-Hartman
dd312acc27
Merge pull request #207 from aurel32/debian-usb.ids
lsusb.py: add usb.ids path for Debian
2024-11-10 15:47:55 +01:00
Greg Kroah-Hartman
74c5fdc280
Merge pull request #208 from gregkh/dependabot/github_actions/all-actions-71f7308342
ci: bump the all-actions group with 4 updates
2024-11-10 15:45:16 +01:00
dependabot[bot]
ceed7cac9a
ci: bump the all-actions group with 4 updates
Bumps the all-actions group with 4 updates: [actions/checkout](https://github.com/actions/checkout), [yshui/git-clang-format-lint](https://github.com/yshui/git-clang-format-lint), [github/codeql-action](https://github.com/github/codeql-action) and [actions/setup-python](https://github.com/actions/setup-python).


Updates `actions/checkout` from 4.1.7 to 4.2.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.7...11bd71901bbe5b1630ceea73d27597364c9af683)

Updates `yshui/git-clang-format-lint` from 1.16 to 1.17
- [Release notes](https://github.com/yshui/git-clang-format-lint/releases)
- [Commits](a65b466f59...27f3890c66)

Updates `github/codeql-action` from 3.26.10 to 3.27.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e2b3eafc8d...662472033e)

Updates `actions/setup-python` from 5.2.0 to 5.3.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](f677139bbe...0b93645e9f)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: yshui/git-clang-format-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-01 22:56:37 +00:00
Aurelien Jarno
3fd7d1fac4 lsusb.py: add usb.ids path for Debian
Commit 008e330759 ("lsusb.py: remove @DATADIR@ instance") removed the
possibility to define the location of the usb.ids file through @DATADIR@
and instead hardcodes the possible paths to the usb.ids file. However
the Debian path is missing, fix that.

Fixes: 008e330759 ("lsusb.py: remove @DATADIR@ instance")
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2024-10-25 21:33:21 +02:00
Greg Kroah-Hartman
cda6883cad usbutils 018 release
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-22 11:33:33 +02:00
Greg Kroah-Hartman
c8dade4b8c usbutils.spdx: update checksums
Some .c files changed, so update the file checksums for them in the
.spdx file to keep things up to date for a release.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-22 11:30:43 +02:00
Greg Kroah-Hartman
59f1fe166f sysfs.c: fix an theoretical issue with snprintf()
Again, code scanners really don't like C string functions, and warn
about the potential for a buffer to possibly be too big for a snprintf()
call as the checking wasn't quite correct.  Fix the check for a buffer
overflow up better and handle any potential issues that checking tools
could come up with.

No real functional change as the sysfs path should be just fine.  And
really, this is all just userspace code...

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-22 11:17:18 +02:00
Greg Kroah-Hartman
bb1e4b7dce usbreset: replace some unbounded strcpy() calls
We "know" the sysfs attribute is not going to be bigger than the buffer,
but the thousands of "ooh, a strcpy() call is bad for you!" scanning
tools do not.  So to shut them up, use strncpy() just to make things
quiet and for us to stop getting foolish reports.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-22 11:06:18 +02:00
Greg Kroah-Hartman
a73e7ce5b8 usbutils.spdx: update due to new file and checksums
There is a new file in the repo, and the checksums have changed in many
others, so update the .spdx file to reflect this.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-22 11:00:37 +02:00
Greg Kroah-Hartman
7f9c48a6fc
Merge pull request #206 from evelikov/moar-ci
ci: minor polish, add codespell action, add clang permutation
2024-10-16 18:45:21 +02:00
Emil Velikov
52f333ae04 ci: add codespell action, fix all typos
v2:
 - ignore NEWS, omit suppressions
 - split off style changes

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-16 16:57:34 +01:00
Emil Velikov
425f92c009 usb-spec: move the opening curly brackets to end of line
That's our defined style and that we've been using in the majority of
the codebase.

Disable clang-format on a couple of sections, where it gets a silly
moment and insists on reformatting everything.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-16 16:56:02 +01:00
Emil Velikov
f41d657dd6 lsusb: reformat and add trailing commas for multi-line arrays
Make the code a bit more clean and consistent.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-16 16:47:41 +01:00
Emil Velikov
d4b78d735f ci: add clang permutation, for 64bit only
Throw clang into the matrix, so we get a bit of extra coverage. As
evidenced by the disabled warning - it does catch extra issues.

Currently enabled only for 64bit builds, since fiddling with environment
variables and cross-files is more tricky than I can be asked atm x-D

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-16 17:31:11 +02:00
Emil Velikov
da218a4b4e ci: drop the mkdir && cd dance
The meson build system can create and change into the directory on its
own. Drop the manual steps.

Silly copy/paste left over from another project this file originates.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-16 17:30:24 +02:00
Emil Velikov
5827abb784 ci: directly use archlinux:multilib-devel
I've introduced the container an year or so ago, to avoid the manual
pacman.conf fiddle. Although the last few months it wasn't quite working
as expected due to expired publishing tokens et al.

With that fixed we can use it \o/

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-16 17:30:00 +02:00
Emil Velikov
595d3785fa clang-format: bump column limit to 120
... to align with the .editorconfig value.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-16 17:29:29 +02:00
Greg Kroah-Hartman
33b083c9f7
Merge pull request #205 from tsundre/add-videocontrol-endpoint-descr
lsusb: add VideoControl Endpoint Descriptor
2024-10-11 07:11:43 +02:00
Torleiv Sundre
9f96a67c0f lsusb: add VideoControl Endpoint Descriptor
Add support for parsing the Class-specific VC Interrupt Endpoint
Descriptor as described in UVC 1.1 spec 3.8.2.2.

Sample output, including the preceding endpoint descriptor:
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               8
        bMaxBurst               0
        VideoControl Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      3 (EP_INTERRUPT)
          wMaxTransferSize       16

Signed-off-by: Torleiv Sundre <torleiv@huddly.com>
2024-10-10 10:19:59 +02:00
Greg Kroah-Hartman
140ba952fa usbutils.spdx: update based on file additions
Update the .spdx file based on new files added to the repo.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-02 08:43:47 +02:00
Greg Kroah-Hartman
a69ea69074 justfile: add some more targets
Add the "spdx" and "lint" targets to make typing things we do all the
time easier.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-02 08:42:41 +02:00
Greg Kroah-Hartman
e7db52d45a
Merge pull request #204 from gregkh/dependabot/github_actions/all-actions-b6c4674bda
ci: bump the all-actions group with 2 updates
2024-10-02 08:06:44 +02:00
dependabot[bot]
6fe0cef19d
ci: bump the all-actions group with 2 updates
Bumps the all-actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/checkout` from 4.1.7 to 4.2.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](692973e3d9...d632683dd7)

Updates `github/codeql-action` from 3.26.8 to 3.26.10
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](294a9d9291...e2b3eafc8d)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-01 22:49:30 +00:00
Greg Kroah-Hartman
a68705def3 lsusb-t: fix memory leak
The lists were never being cleaned up when finished, so properly walk
them and free the allocated the memory that was allocated.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-01 20:08:38 +02:00
Greg Kroah-Hartman
d04e63e551 LICENSES: add CC0 and MIT licenses
To make 'reuse lint' happy, add the missing license texts.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-01 19:57:13 +02:00
Greg Kroah-Hartman
829d1abbc8 lsusb-t: get rid of custom list.h logic
The list.h code is REALLY old, from a very old kernel version.  Import
the CCAN version instead, and move the code to use it.  This is in
anticipation of fixing up the memory leaks in this area.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-01 19:51:58 +02:00
Greg Kroah-Hartman
e6573d16a1 clang-format: fix SPDX license
It is "GPL-2.0-only" not "GPL-2.0".  Ugh, I hate the FSF for that
mess...

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-01 19:09:50 +02:00
Greg Kroah-Hartman
8e6739b8f8 clang-format: add proper copyright information
Add Miguel's copyright information as he was the original committer of
the file to Linux.  Also remove the unneeded Documentation/ entry as
that makes no sense in this project.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-01 19:08:36 +02:00
Emil Velikov
7f5b125324 ci: add clang-format action
It will help enforce the style defined in .clang-format, only for newly
introduced changes. Pre-existing style issues will not be flagged,
unless the lines are changed with given commit.

If a particular section needs to be ignored, it should be wrapped in
clang-format off/on section.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-01 16:45:28 +02:00
Emil Velikov
1f11e26e4f .clang-format: update for_each pattern and list
Swap kernel list of for_each macros for what we actually use in-tree.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-01 16:45:28 +02:00
Emil Velikov
d7a4b19ae0 .clang-format: import from Linux kernel as of v6.11.-rc6
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-01 16:45:28 +02:00
Greg Kroah-Hartman
544028d677 editorconfig: make the line length 120
We all have things larger than 80 columns these days.  If this gets too
out of hand, we can reduce it later.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-01 16:43:37 +02:00
Emil Velikov
99fcc8f5ed editorconfig: add initial config file
Most editors support the config format out of the box and with some
patches in the works, it's great to have something in-tree to avoid
(further) mixing the style.

The format is sufficient to handle basic indentation size/style and line
length. More elaborate style tracking can be done with clang-format...
incoming with a later patch.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-01 16:42:31 +02:00
Greg Kroah-Hartman
ee65ab5263
Merge pull request #202 from evelikov/remove-hashtables
Remove hashtables
2024-10-01 15:08:58 +02:00
Emil Velikov
97508b2393 meson: re-enable some warnings
The former is clang-only, which has been clean for a while. While the
latter is gone with the hash tables removal as of earlier commits.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-01 13:44:56 +01:00
Emil Velikov
92547bee59 lsusb: drop the genericstrtable hash tables
This seems like a premature ahead-of-time optimisation, which actually
hurts both code/binary size while providing no performance benefit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-01 13:44:56 +01:00
Emil Velikov
d9e91b7dd0 lsusb: drop the videoterminal hash table
This seems like a premature ahead-of-time optimisation, which actually
hurts both code/binary size while providing no performance benefit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-01 13:44:56 +01:00
Emil Velikov
0f5c572b73 lsusb: drop the audioterminal hash table
This seems like a premature ahead-of-time optimisation, which actually
hurts both code/binary size while providing no performance benefit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-01 13:44:56 +01:00
Greg Kroah-Hartman
70033affd5 update usbutils.spdx file
Now that the man pages moved around, and we flushed out the remaining
copyright/license file descriptions, update the .spdx file with all of
the latest information.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 20:20:03 +02:00