aboutsummaryrefslogtreecommitdiff
path: root/driver_library
diff options
context:
space:
mode:
authorMikael Olsson <mikael.olsson@arm.com>2023-08-16 15:22:19 +0200
committerMikael Olsson <mikael.olsson@arm.com>2023-08-16 15:33:31 +0200
commit99429e1042a0fd9fb11a2f348eb36249161134ac (patch)
treef01e80f9c1c3f4410951da3b224790879c80817d /driver_library
parent42699b0ac92cfd7236f44aa6c00caf625b022b79 (diff)
downloadethos-u-linux-driver-stack-99429e1042a0fd9fb11a2f348eb36249161134ac.tar.gz
Add command and error to IOCTL failure exception
When an IOCTL call fails in the driver library, the failure exception only states "IOCTL failed" without any further information. To make it easier to see what IOCTL call failed and why, the exception will now include the command that failed and the reason for the failure. Change-Id: Ife4957d2c0d692b3fcdbdc72538690d50385d365 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Diffstat (limited to 'driver_library')
-rw-r--r--driver_library/src/ethosu.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/driver_library/src/ethosu.cpp b/driver_library/src/ethosu.cpp
index 64aee4d..dcdde8c 100644
--- a/driver_library/src/ethosu.cpp
+++ b/driver_library/src/ethosu.cpp
@@ -20,7 +20,9 @@
#include <uapi/ethosu.h>
#include <algorithm>
+#include <cerrno>
#include <cstdlib>
+#include <cstring>
#include <exception>
#include <fstream>
#include <iomanip>
@@ -104,7 +106,7 @@ const SemanticVersion getLibraryVersion() {
__attribute__((weak)) int eioctl(int fd, unsigned long cmd, void *data = nullptr) {
int ret = ::ioctl(fd, cmd, data);
if (ret < 0) {
- throw EthosU::Exception("IOCTL failed");
+ throw EthosU::Exception(string("IOCTL cmd=").append(to_string(cmd) + " failed: " + strerror(errno)).c_str());
}
Log(Severity::Debug) << "ioctl. fd=" << fd << ", cmd=" << setw(8) << setfill('0') << hex << cmd << ", ret=" << ret