summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-06-27 15:24:44 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-28 07:08:52 +0000
commit7b4020f72963c16ac1d8fa20a779eef8ae79588b (patch)
tree9f21436bd212849919777c37dafb6f5e439b4adf
parent780cf51a57d4c3512bae26b63f445122094a596b (diff)
downloadchrome-ec-7b4020f72963c16ac1d8fa20a779eef8ae79588b.tar.gz
test/usb_test/device_configuration.c: Format with clang-format
BUG=b:236386294 BRANCH=none TEST=none Change-Id: I295716f7233e7afad720a4567ea7cfd9aa4b67aa Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730579 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
-rw-r--r--test/usb_test/device_configuration.c59
1 files changed, 27 insertions, 32 deletions
diff --git a/test/usb_test/device_configuration.c b/test/usb_test/device_configuration.c
index 69f889c2d3..2edb124b9f 100644
--- a/test/usb_test/device_configuration.c
+++ b/test/usb_test/device_configuration.c
@@ -13,8 +13,8 @@
#include <string.h>
/* Options */
-static uint16_t vid = 0x18d1; /* Google */
-static uint16_t pid = 0x5014; /* Cr50 */
+static uint16_t vid = 0x18d1; /* Google */
+static uint16_t pid = 0x5014; /* Cr50 */
static char *progname;
@@ -25,7 +25,8 @@ static void usage(int errs)
"Set/Get the USB Device Configuration value\n"
"\n"
"The default vid:pid is %04x:%04x\n"
- "\n", progname, vid, pid);
+ "\n",
+ progname, vid, pid);
exit(!!errs);
}
@@ -49,14 +50,13 @@ static void stupid_usb(const char *format, ...)
exit(1);
}
-
int main(int argc, char *argv[])
{
int r = 1;
int errorcnt = 0;
int do_set = 0;
uint16_t setval = 0;
- uint8_t buf[80]; /* Arbitrary size */
+ uint8_t buf[80]; /* Arbitrary size */
int i;
progname = strrchr(argv[0], '/');
@@ -65,13 +65,13 @@ int main(int argc, char *argv[])
else
progname = argv[0];
- opterr = 0; /* quiet, you */
+ opterr = 0; /* quiet, you */
while ((i = getopt(argc, argv, "")) != -1) {
switch (i) {
case 'h':
usage(errorcnt);
break;
- case 0: /* auto-handled option */
+ case 0: /* auto-handled option */
break;
case '?':
if (optopt)
@@ -111,8 +111,8 @@ int main(int argc, char *argv[])
r = libusb_init(NULL);
if (r) {
- printf("libusb_init() returned 0x%x: %s\n",
- r, libusb_error_name(r));
+ printf("libusb_init() returned 0x%x: %s\n", r,
+ libusb_error_name(r));
return 1;
}
@@ -122,41 +122,36 @@ int main(int argc, char *argv[])
stupid_usb("Can't open device %04x:%04x\n", vid, pid);
}
-
/* Set config*/
if (do_set) {
printf("SetCfg %d\n", setval);
- r = libusb_control_transfer(
- devh,
- 0x00, /* bmRequestType */
- 0x09, /* bRequest */
- setval, /* wValue */
- 0x0000, /* wIndex */
- NULL, /* data */
- 0x0000, /* wLength */
- 1000); /* timeout (ms) */
+ r = libusb_control_transfer(devh, 0x00, /* bmRequestType */
+ 0x09, /* bRequest */
+ setval, /* wValue */
+ 0x0000, /* wIndex */
+ NULL, /* data */
+ 0x0000, /* wLength */
+ 1000); /* timeout (ms) */
if (r < 0)
- printf("transfer returned 0x%x %s\n",
- r, libusb_error_name(r));
+ printf("transfer returned 0x%x %s\n", r,
+ libusb_error_name(r));
}
/* Get config */
memset(buf, 0, sizeof(buf));
- r = libusb_control_transfer(
- devh,
- 0x80, /* bmRequestType */
- 0x08, /* bRequest */
- 0x0000, /* wValue */
- 0x0000, /* wIndex */
- buf, /* data */
- 0x0001, /* wLength */
- 1000); /* timeout (ms) */
+ r = libusb_control_transfer(devh, 0x80, /* bmRequestType */
+ 0x08, /* bRequest */
+ 0x0000, /* wValue */
+ 0x0000, /* wIndex */
+ buf, /* data */
+ 0x0001, /* wLength */
+ 1000); /* timeout (ms) */
if (r <= 0)
- stupid_usb("GetCfg transfer() returned 0x%x %s\n",
- r, libusb_error_name(r));
+ stupid_usb("GetCfg transfer() returned 0x%x %s\n", r,
+ libusb_error_name(r));
printf("GetCfg returned %d bytes:", r);
for (i = 0; i < r; i++)