Skip to content

Commit

Permalink
Merge pull request #206 from evelikov/moar-ci
Browse files Browse the repository at this point in the history
ci: minor polish, add codespell action, add clang permutation
  • Loading branch information
gregkh authored Oct 16, 2024
2 parents d4b78d7 + 52f333a commit 7f9c48a
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 68 deletions.
8 changes: 8 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: 2024 Emil Velikov <[email protected]>
#
# SPDX-License-Identifier: LGPL-2.1-or-later

bridg
iIF
ser
wHeight
24 changes: 24 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2024 Emil Velikov <[email protected]>
#
# SPDX-License-Identifier: LGPL-2.1-or-later

name: Check spelling with codespell

on:
push:
branches: [master, ci-test]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: codespell-project/actions-codespell@406322ec52dd7b488e48c1c4b82e2a8b3a1bf630 # v2.1
with:
ignore_words_file: .codespellignore
skip: NEWS
2 changes: 1 addition & 1 deletion ccan/list/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ static inline void list_prepend_list_(struct list_head *to,
* @off: offset(relative to @i) at which list node data resides.
*
* This is a low-level wrapper to iterate @i over the entire list, used to
* implement all oher, more high-level, for-each constructs. It's a for loop,
* implement all other, more high-level, for-each constructs. It's a for loop,
* so you can break and continue as normal.
*
* WARNING! Being the low-level macro that it is, this wrapper doesn't know
Expand Down
4 changes: 2 additions & 2 deletions desc-dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static void number_renderer(
/**
* Render a field's value to stdout.
*
* The manner of rendering the value is dependant on the value type.
* The manner of rendering the value is dependent on the value type.
*
* \param[in] dev LibUSB device handle.
* \param[in] current Descriptor definition field to render.
Expand Down Expand Up @@ -320,7 +320,7 @@ static void value_renderer(
const struct desc *ext_desc;
const struct desc_ext *ext;

/* Lookup the extention descriptor definitions to use, */
/* Lookup the extension descriptor definitions to use, */
for (ext = current->extension.d; ext->desc != NULL; ext++) {
if (ext->type == type) {
ext_desc = ext->desc;
Expand Down
113 changes: 73 additions & 40 deletions lsusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,30 +117,19 @@

unsigned int verblevel = VERBLEVEL_DEFAULT;
static int do_report_desc = 1;
static const char * const encryption_type[] = {
"UNSECURE",
"WIRED",
"CCM_1",
"RSA_1",
"RESERVED"
static const char *const encryption_type[] = {
"INSECURE", "WIRED", "CCM_1", "RSA_1", "RESERVED",
};

static const char * const vconn_power[] = {
"1W",
"1.5W",
"2W",
"3W",
"4W",
"5W",
"6W",
"reserved"
static const char *const vconn_power[] = {
"1W", "1.5W", "2W", "3W", "4W", "5W", "6W", "reserved",
};

static const char * const alt_mode_state[] = {
static const char *const alt_mode_state[] = {
"Unspecified Error",
"Alternate Mode configuration not attempted",
"Alternate Mode configuration attempted but unsuccessful",
"Alternate Mode configuration successful"
"Alternate Mode configuration successful",
};

static void dump_interface(libusb_device_handle *dev, const struct libusb_interface *interface);
Expand Down Expand Up @@ -1541,32 +1530,76 @@ static void dump_midistreaming_endpoint(const unsigned char *buf)

static void dump_videocontrol_interface(libusb_device_handle *dev, const unsigned char *buf, int protocol)
{
static const char * const ctrlnames[] = {
"Brightness", "Contrast", "Hue", "Saturation", "Sharpness", "Gamma",
"White Balance Temperature", "White Balance Component", "Backlight Compensation",
"Gain", "Power Line Frequency", "Hue, Auto", "White Balance Temperature, Auto",
"White Balance Component, Auto", "Digital Multiplier", "Digital Multiplier Limit",
"Analog Video Standard", "Analog Video Lock Status", "Contrast, Auto"
static const char *const ctrlnames[] = {
"Brightness",
"Contrast",
"Hue",
"Saturation",
"Sharpness",
"Gamma",
"White Balance Temperature",
"White Balance Component",
"Backlight Compensation",
"Gain",
"Power Line Frequency",
"Hue, Auto",
"White Balance Temperature, Auto",
"White Balance Component, Auto",
"Digital Multiplier",
"Digital Multiplier Limit",
"Analog Video Standard",
"Analog Video Lock Status",
"Contrast, Auto",
};
static const char * const camctrlnames[] = {
"Scanning Mode", "Auto-Exposure Mode", "Auto-Exposure Priority",
"Exposure Time (Absolute)", "Exposure Time (Relative)", "Focus (Absolute)",
"Focus (Relative)", "Iris (Absolute)", "Iris (Relative)", "Zoom (Absolute)",
"Zoom (Relative)", "PanTilt (Absolute)", "PanTilt (Relative)",
"Roll (Absolute)", "Roll (Relative)", "Reserved", "Reserved", "Focus, Auto",
"Privacy", "Focus, Simple", "Window", "Region of Interest"
static const char *const camctrlnames[] = {
"Scanning Mode",
"Auto-Exposure Mode",
"Auto-Exposure Priority",
"Exposure Time (Absolute)",
"Exposure Time (Relative)",
"Focus (Absolute)",
"Focus (Relative)",
"Iris (Absolute)",
"Iris (Relative)",
"Zoom (Absolute)",
"Zoom (Relative)",
"PanTilt (Absolute)",
"PanTilt (Relative)",
"Roll (Absolute)",
"Roll (Relative)",
"Reserved",
"Reserved",
"Focus, Auto",
"Privacy",
"Focus, Simple",
"Window",
"Region of Interest",
};
static const char *const enctrlnames[] = {
"Select Layer",
"Profile and Toolset",
"Video Resolution",
"Minimum Frame Interval",
"Slice Mode",
"Rate Control Mode",
"Average Bit Rate",
"CPB Size",
"Peak Bit Rate",
"Quantization Parameter",
"Synchronization and Long-Term Reference Frame",
"Long-Term Buffer",
"Picture Long-Term Reference",
"LTR Validation",
"Level IDC",
"SEI Message",
"QP Range",
"Priority ID",
"Start or Stop Layer/View",
"Error Resiliency",
};
static const char * const enctrlnames[] = {
"Select Layer", "Profile and Toolset", "Video Resolution", "Minimum Frame Interval",
"Slice Mode", "Rate Control Mode", "Average Bit Rate", "CPB Size", "Peak Bit Rate",
"Quantization Parameter", "Synchronization and Long-Term Reference Frame",
"Long-Term Buffer", "Picture Long-Term Reference", "LTR Validation",
"Level IDC", "SEI Message", "QP Range", "Priority ID", "Start or Stop Layer/View",
"Error Resiliency"
static const char *const stdnames[] = {
"None", "NTSC - 525/60", "PAL - 625/50", "SECAM - 625/50", "NTSC - 625/50", "PAL - 525/60",
};
static const char * const stdnames[] = {
"None", "NTSC - 525/60", "PAL - 625/50", "SECAM - 625/50",
"NTSC - 625/50", "PAL - 525/60" };
unsigned int i, ctrls, stds, n, p, termt, freq;
char *term = NULL, termts[128];

Expand Down
42 changes: 18 additions & 24 deletions usb-spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ struct genericstrtable {

/* ---------------------------------------------------------------------- */

static const struct audioterminal audioterminals[] =
{
static const struct audioterminal audioterminals[] = {
{ 0x0100, "USB Undefined" },
{ 0x0101, "USB Streaming" },
{ 0x01ff, "USB Vendor Specific" },
Expand Down Expand Up @@ -88,8 +87,7 @@ static const struct audioterminal audioterminals[] =
{ 0x0000, NULL },
};

static const struct videoterminal videoterminals[] =
{
static const struct videoterminal videoterminals[] = {
{ 0x0100, "USB Vendor Specific" },
{ 0x0101, "USB Streaming" },
{ 0x0200, "Input Vendor Specific" },
Expand All @@ -105,16 +103,14 @@ static const struct videoterminal videoterminals[] =
{ 0x0000, NULL },
};

static const struct genericstrtable hiddescriptors[] =
{
static const struct genericstrtable hiddescriptors[] = {
{ 0x21, "HID" },
{ 0x22, "Report" },
{ 0x23, "Physical" },
{ 0x00, NULL },
};

static const struct genericstrtable reports[] =
{
static const struct genericstrtable reports[] = {
{ 0x04, "Usage Page" },
{ 0x08, "Usage" },
{ 0x14, "Logical Minimum" },
Expand Down Expand Up @@ -145,8 +141,7 @@ static const struct genericstrtable reports[] =
{ 0x00, NULL },
};

static const struct genericstrtable huts[] =
{
static const struct genericstrtable huts[] = {
{ 0x00, "Undefined" },
{ 0x01, "Generic Desktop Controls" },
{ 0x02, "Simulation Controls" },
Expand Down Expand Up @@ -179,18 +174,19 @@ static const struct genericstrtable huts[] =
{ 0x00, NULL },
};

static const struct genericstrtable biass[] =
{
static const struct genericstrtable biass[] = {
// clang-format off
{ 0x0, "Not Applicable" },
{ 0x1, "Right Hand" },
{ 0x2, "Left Hand" },
{ 0x3, "Both Hands" },
{ 0x4, "Either Hand" },
{ 0x0, NULL },
// clang-format on
};

static const struct genericstrtable physdess[] =
{
static const struct genericstrtable physdess[] = {
// clang-format off
{ 0x00, "None" },
{ 0x01, "Hand" },
{ 0x02, "Eyeball" },
Expand Down Expand Up @@ -232,13 +228,13 @@ static const struct genericstrtable physdess[] =
{ 0x26, "Brow" },
{ 0x27, "Cheek" },
{ 0x00, NULL },
// clang-format on
};

/* HUT usage specs are represented as:
* (huttype << 16) + hutus
*/
static const struct genericstrtable hutus[] =
{
static const struct genericstrtable hutus[] = {
{ (0x01 << 16) + 0x000, "Undefined" },
{ (0x01 << 16) + 0x001, "Pointer" },
{ (0x01 << 16) + 0x002, "Mouse" },
Expand Down Expand Up @@ -296,7 +292,7 @@ static const struct genericstrtable hutus[] =
{ (0x02 << 16) + 0x006, "Sailing Simulation Device" },
{ (0x02 << 16) + 0x007, "Motorcycle Simulation Device" },
{ (0x02 << 16) + 0x008, "Sports Simulation Device" },
{ (0x02 << 16) + 0x009, "Airplane Simualtion Device" },
{ (0x02 << 16) + 0x009, "Airplane Simulation Device" },
{ (0x02 << 16) + 0x00a, "Helicopter Simulation Device" },
{ (0x02 << 16) + 0x00b, "Magic Carpet Simulation Device" },
{ (0x02 << 16) + 0x00c, "Bicycle Simulation Device" },
Expand Down Expand Up @@ -900,7 +896,7 @@ static const struct genericstrtable hutus[] =
{ (0x0c << 16) + 0x18d, "AL Contacts/Address Book" },
{ (0x0c << 16) + 0x18e, "AL Calendar/Schedule" },
{ (0x0c << 16) + 0x18f, "AL Task/Project Manager" },
{ (0x0c << 16) + 0x190, "AL Log/Jounal/Timecard" },
{ (0x0c << 16) + 0x190, "AL Log/Journal/Timecard" },
{ (0x0c << 16) + 0x191, "AL Checkbook/Finance" },
{ (0x0c << 16) + 0x192, "AL Calculator" },
{ (0x0c << 16) + 0x193, "AL A/V Capture/Playback" },
Expand Down Expand Up @@ -1196,7 +1192,7 @@ static const struct genericstrtable hutus[] =
{ (0x82 << 16) + 0x06e, "Green Video Black Level" },
{ (0x82 << 16) + 0x070, "Blue Video Black Level" },
{ (0x82 << 16) + 0x0a2, "Auto Size Center" },
{ (0x82 << 16) + 0x0a4, "Polarity Horizontal Sychronization" },
{ (0x82 << 16) + 0x0a4, "Polarity Horizontal Synchronization" },
{ (0x82 << 16) + 0x0a6, "Polarity Vertical Synchronization" },
{ (0x82 << 16) + 0x0aa, "Screen Orientation" },
{ (0x82 << 16) + 0x0ac, "Horizontal Frequency in Hz" },
Expand Down Expand Up @@ -1385,8 +1381,7 @@ static const struct genericstrtable hutus[] =
/* dialects are represented as:
* langid + (dialectid << 10)
*/
static const struct genericstrtable langids[] =
{
static const struct genericstrtable langids[] = {
{ 0x0001 + (0x01 << 10), "Saudi Arabia" },
{ 0x0001 + (0x02 << 10), "Iraq" },
{ 0x0001 + (0x03 << 10), "Egypt" },
Expand Down Expand Up @@ -1429,7 +1424,7 @@ static const struct genericstrtable langids[] =
{ 0x0009 + (0x06 << 10), "Ireland" },
{ 0x0009 + (0x07 << 10), "South Africa" },
{ 0x0009 + (0x08 << 10), "Jamaica" },
{ 0x0009 + (0x09 << 10), "Carribean" },
{ 0x0009 + (0x09 << 10), "Caribbean" },
{ 0x0009 + (0x0a << 10), "Belize" },
{ 0x0009 + (0x0b << 10), "Trinidad" },
{ 0x0009 + (0x0c << 10), "Zimbabwe" },
Expand Down Expand Up @@ -1552,8 +1547,7 @@ static const struct genericstrtable langids[] =
{ 0x0000, NULL },
};

static const struct genericstrtable countrycodes[] =
{
static const struct genericstrtable countrycodes[] = {
{ 0, "Not supported" },
{ 1, "Arabic" },
{ 2, "Belgian" },
Expand Down
2 changes: 1 addition & 1 deletion usbhid-dump/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Added interface number limiting option -i, --interface=NUMBER.
* Added stream interrupt transfer timeout option -t,
--stream-timeout=NUMBER, which is set to 1 minute by default to
allow recovery of accidentially captured terminal input device.
allow recovery of accidentally captured terminal input device.
This timeout is printed on the start of stream dumping.

2010-08-24: 1.1
Expand Down

0 comments on commit 7f9c48a

Please sign in to comment.