Skip to content

Ubuntu 20.04 - ioctl SIOCGIFNAME: Inappropriate ioctl for device #11

@engnfrc

Description

@engnfrc

I'm trying to get the Linux LIN stuff working and am running into troubles. I've built on the sllin ko on my target platform running Ubuntu 20.04 with a low-latency kernel (5.4.0-42-lowlatency) and then I've checked out can-utils and updated the files to do what I think your old files are trying to show (see below). Now when I run sudo ./slcan_attach -w /dev/ttyS0 I get this error: "ioctl SIOCGIFNAME: Inappropriate ioctl for device". Looking at /usr/include/linux/tty.h N_SLLIN 25 does not exist, is this the issue? Are we expected to do Kernel mods to make this stuff work? I would certainly prefer not to have to go that route...

Git Diff:

index cc13c37..acea823 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSO_RXQ_OVFL=40")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPF_CAN=29")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAF_CAN=PF_CAN")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DN_SLCAN=17")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DN_SLLIN=25")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSCM_TIMESTAMPING_OPT_STATS=54")

 include_directories (.)
diff --git a/configure.ac b/configure.ac
index f44a5e2..d31b528 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,9 @@ AC_CHECK_DECL(AF_CAN,,
 AC_CHECK_DECL(N_SLCAN,,
     [AC_DEFINE([N_SLCAN], [17], [N_SLCAN])]
 )
+AC_CHECK_DECL(N_SLLIN,,
+    [AC_DEFINE([N_SLLIN], [25], [N_SLLIN])]
+)
 AC_CHECK_DECL(SCM_TIMESTAMPING_OPT_STATS,,
     [AC_DEFINE([SCM_TIMESTAMPING_OPT_STATS], [54], [SCM_TIMESTAMPING_OPT_STATS])]
 )
diff --git a/slcan_attach.c b/slcan_attach.c
index dc8e9f2..ab2e5f6 100644
--- a/slcan_attach.c
+++ b/slcan_attach.c
@@ -92,7 +92,8 @@ void print_usage(char *prg)
 int main(int argc, char **argv)
 {
        int fd;
-       int ldisc = N_SLCAN;
+       //int ldisc = N_SLCAN;
+       int ldisc = N_SLLIN;
        int detach = 0;
        int waitkey = 0;
        int send_open = 0;
diff --git a/slcand.c b/slcand.c
index 4a15697..858b0f5 100644
--- a/slcand.c
+++ b/slcand.c
@@ -199,7 +199,8 @@ int main(int argc, char *argv[])
        char *btr = NULL;
        int run_as_daemon = 1;
        char *pch;
-       int ldisc = N_SLCAN;
+       //int ldisc = N_SLCAN;
+       int ldisc = N_SLLIN;
        int fd;

        ttypath[0] = '\0';```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions