Initial commit
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
From 195d528024bda107f9b7ab883883db9d0a917f3d Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Doman <jonathan.doman@intel.com>
|
||||
Date: Fri, 11 Mar 2022 11:58:55 -0800
|
||||
Subject: [PATCH] Output error message for invalid device
|
||||
|
||||
Lack of error message when user provided invalid device results in
|
||||
confusion. Make it clear what is wrong.
|
||||
|
||||
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
|
||||
Upstream-Status: Pending
|
||||
---
|
||||
i3ctransfer.c | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/i3ctransfer.c b/i3ctransfer.c
|
||||
index 816b9ad..413f547 100644
|
||||
--- a/i3ctransfer.c
|
||||
+++ b/i3ctransfer.c
|
||||
@@ -103,9 +103,9 @@ static void print_rx_data(struct i3c_ioc_priv_xfer *xfer)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct i3c_ioc_priv_xfer *xfers;
|
||||
- int file, ret, opt, i;
|
||||
+ int file = -1, ret, opt, i;
|
||||
int nxfers = 0;
|
||||
- char *device;
|
||||
+ char *device = NULL;
|
||||
|
||||
while ((opt = getopt_long(argc, argv, sopts, lopts, NULL)) != EOF) {
|
||||
switch (opt) {
|
||||
@@ -130,12 +130,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
- if (!device)
|
||||
- exit(EXIT_FAILURE);
|
||||
+ if (device)
|
||||
+ file = open(device, O_RDWR);
|
||||
|
||||
- file = open(device, O_RDWR);
|
||||
- if (file < 0)
|
||||
+ if (file < 0) {
|
||||
+ fprintf(stderr, "Error: %s\n", device ? strerror(errno) : "No device provided");
|
||||
exit(EXIT_FAILURE);
|
||||
+ }
|
||||
|
||||
xfers = (struct i3c_ioc_priv_xfer *)calloc(nxfers, sizeof(*xfers));
|
||||
if (!xfers)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
SUMMARY = "i3c-tools"
|
||||
DESCRIPTION = "Set of tools to interact with i3c devices from user space"
|
||||
|
||||
SRC_URI = "git://github.com/vitor-soares-snps/i3c-tools.git;branch=master;protocol=https \
|
||||
file://0001-Output-error-message-for-invalid-device.patch \
|
||||
"
|
||||
SRCREV = "5d752038c72af8e011a2cf988b1476872206e706"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
PV = "0.1+git${SRCPV}"
|
||||
|
||||
LICENSE = "GPL-2.0"
|
||||
LIC_FILES_CHKSUM = "\
|
||||
file://i3ctransfer.c;beginline=1;endline=6;md5=8a1ae5c1aaf128e640de497ceaa9935e \
|
||||
"
|
||||
|
||||
inherit meson
|
||||
Reference in New Issue
Block a user