Skip to content

Tag: ioctl

slcand error : Inappropriate ioctl for device

I want to use can interface with slcand, but I have a problem. To link can device(canable) with slcand, I make symbolic link with udev-rule SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, ATTR{product}==”canable gs_usb”, ATTR{serial}==”002900355934570820373433″, S…

Identify virtual network interface in c

I am trying to find which interface my device is running on with C. I scanned all interfaces with ioctl, I arranged the result as : I used getifaddrs() to get list of interfces, then ioctl (IP using SIOCGIFADDR), (flags using SIOCGIFFLAGS) enum net_device_flags, and (mac using SIOCGIFHWADDR). From the list, I…

SIOCGIFCONF return only loopback interface

I want to get all network interfaces names present on the system. For system portability (Android included) I decided to write a method that performs this task using ioctl because I think (probably wrongly) that ioctl is one of the best for this task. So I wrote this code But the problem is, that it returns o…

Write magnetic tape end of record linux

Task is create two record with different sizes within one file entry. I’m using python 3.4.5 for testing: Is there an ioctl opt code that will initiate a new record on the tape with variable record length. Or any other way to work around this bug? Answer Issue was with tcopy, it uses block size on devic…

ioctl() call resets file descriptor to 0

Consider the following code: This snippet yields this: Why does my file descriptor get reset to 0? The program writes the stuff out to stdout instead of my block device. This should not happen. I expect my file_fd to be non-zero and retain its value. Answer Looks like you smash your stack. Since there are onl…

Remap a keyboard with ioctl under linux

I am actually trying to write a small program to catch global keyboard inputs from specific USB keyboards under linux. I am testing with this piece of code : Ths point is that I don’t know how to change some input key by other. I tried by calling write() on currently red event by changing the event code…