Commit Graph

848 Commits

Author SHA1 Message Date
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
Greg Kroah-Hartman
8ed86f6743
Merge pull request #201 from evelikov/spdx-and-reuse
Add the final SPDX identifiers, alongside reuse-lint CI workflow
2024-09-30 20:08:42 +02:00
Emil Velikov
7779d07894 ci: add reuse lint stage
Add a workflow to check for issues reported by reuse-tool. The version
installed is picked from usbutils.spdx, so we get consistent results.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-09-30 19:04:06 +01:00
Emil Velikov
86373efd93 man: move manual pages in designated sub-folder
Move the files into designated place, so they're easier to find and
reason with.

While in here, simplify the install_man() call to only include the
strings. Meson will convert them to files() and deduce the correct path
based on the file extension.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-09-30 20:00:30 +02:00
Emil Velikov
7ba5d154e6 ci: add/update the final SPDX identifiers
The actions design in codeql.yml is Lucas' so credit him. The main.yml
file is based on our joint work.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-09-30 18:56:09 +01:00
Emil Velikov
25a7abcec2 .gitmodules: remove no longer needed file
The usbhid-dump repo was imported a while ago, while the upstream
repository has become dormant. Just remove the .gitmodules file.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-09-30 19:53:55 +02:00
Emil Velikov
affc79b65f meson: fold usbhid-dump/meson.build in
The usbhid-dump project effectively lives in this repo (it was a git
module ages ago), so there's little point in the separate build file(s).

People can still build usbhid-dump alone, as below:
    ninja -C builddir/ usbhid-dump

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-09-30 19:53:52 +02:00
Greg Kroah-Hartman
01e0fa856d usbutils.spdx: update the data
Now that we have more license and copyright information, update the
usbutils.spdx file to reflect this information.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-24 15:17:20 +02:00
Greg Kroah-Hartman
32154d0dbe LICENSE: add LGPL-2.1 license text
Now that the build/test scripts use this license, it needs to be added
to the repo to make REUSE happy.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-24 15:15:09 +02:00
Greg Kroah-Hartman
df397a067e
Merge pull request #198 from evelikov/warning-fixes
Resolve "foo discards const qualifier" warnings et al.
2024-09-24 14:56:48 +02:00
Greg Kroah-Hartman
ab5f10c478
Merge pull request #199 from evelikov/monthly-dependabot
ci: run monthly checks by dependabot
2024-09-24 14:52:30 +02:00
Greg Kroah-Hartman
f9f738aea9 README.md: add the linux-usb mailing list to the README.
Private email is fine, but on the list is best.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-24 14:50:54 +02:00
Greg Kroah-Hartman
29c858f8bf README.md: update the SPDX wording a bit
Clean up the wording about SPDX a bit.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-24 14:49:38 +02:00
Greg Kroah-Hartman
616b1f2674
Merge pull request #197 from evelikov/spdx
Add SPDX identifiers, document S-O-B and SPDX
2024-09-24 14:47:57 +02:00
Emil Velikov
3efe524409 ci: run monthly checks by dependabot
Seemingly the CodeQL folks push 1-2 releases a week and the knock on
affect is that dependabot will open PRs every week.

Just move to monthly checks/updates.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-09-24 10:56:43 +01:00
Emil Velikov
a09ff9e528 lsusb: const annotate most data, re-enable -Wdiscarded-qualifiers
With the API fixed and most data annotated as read-only, we can flip the
warning back on.

In theory all the arrays in usb-spec.h can be make constant, although
atm the entries have link to other (hashed) entries and is populated at
program startup.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-09-24 10:46:56 +01:00