Questions tagged [ioctl]

ioctl (Input Output ConTroL) is a system call for device-specific I/O operations and other operations which cannot be expressed by regular system calls and it provides an interface through which an application can communicate directly with a device driver(or any other global kernel space variables). Applications can use the standard control codes or device-specific control codes to perform direct input and output operations.

691 questions
0
votes
2 answers

Linux IOCTL commands

Trying to implement IOCTL commands, and just encountered as below: If _IO is for both read and write than why should I consider _IOR and _IOW any clue please ?
San
  • 905
  • 3
  • 16
  • 33
0
votes
1 answer

IOCTL write crashing

I am trying to implement ioctl in kernel space to write some date into the register, I am getting a crash in cmd of ioctl. Below is my code: Kernel side: static struct file_operations fops = { .compat_ioctl = device_ioctl }; int device_ioctl(struct…
San
  • 905
  • 3
  • 16
  • 33
0
votes
2 answers

Sniffing IOCTL and serial port communication

I'm trying to reverse the protocol used by an early nineties logic analyzer an its PC software. The device is connected via RS-232 (propietary wiring) and communicates with a DOS program, successfully running on DOSBOX. I'm able to control the…
NeonMan
  • 623
  • 10
  • 24
0
votes
2 answers

Is it a good design to write the core main program in c++/shell script when the .so are in pure c?

I would like to write a core main server handles request by user (in shell like enviorment) and load dynamic libraries executes ioctls and some debugfs. The core server is in c++ and the loadable libs are written in c. Is it a good design? What…
0x90
  • 39,472
  • 36
  • 165
  • 245
0
votes
0 answers

IOCTL_ATA_PASS_THROUGH_DIRECT fails in Windows8

Here is my sample code: PATA_PASS_THROUGH_DIRECT pATAPTD = NULL; DWORD dataSize = sizeof(ATA_PASS_THROUGH_DIRECT) + 512; pATAPTD = (PATA_PASS_THROUGH_DIRECT) VirtualAlloc(NULL, dataSize, MEM_COMMIT, PAGE_READWRITE); ZeroMemory(pATAPTD, dataSize);…
0
votes
1 answer

How can the Java InputStream function `available()` be implemented using the C language?

How can the Java InputStream function available() be implemented using the C language? This function returns an estimate of the number of bytes which can be read from an InputStream without blocking by the next invocation of a method for that…
0
votes
1 answer

ioctl failing "No such File or Directory"

I am trying to control a LED on a custom board. I have written the device driver and successfully loaded it. I have created a device file in /dev directory with the correct major number. Then I wrote a program in user plane to control the LED on the…
Neo
  • 141
  • 5
  • 16
0
votes
1 answer

48bit and 28bit ATA commands with ioctl

During sending ATA commands I found several classifications. For example, first one - we can divide the commands to Data-In, Data-Out and Non-Data commands. Another classification can be that there are 48bit commands and 28bit comands. First ones…
Rufi
  • 2,529
  • 1
  • 20
  • 41
0
votes
2 answers

linux driver's function known/visible to application

In windows we create a function in a driver and we can call it from the application using dll as the middle man. What happens in linux? How can we create a custom function (ioctl) for example and call/ use it from the host application? Any…
amanda
  • 394
  • 1
  • 9
0
votes
3 answers

Need of defining ioctl in linux kernel driver

i have started to learn ioctl i got this example http://tldp.org/LDP/lkmpg/2.6/html/x892.html i got total working of ioctal but i am not getting why and where we need to define ioctal for our driver.? For that example Instead of calling…
Jeegar Patel
  • 26,264
  • 51
  • 149
  • 222
0
votes
1 answer

Storage size of isn't known

This is part of an IOCTL switch case. I am getting the following error? error: storage size of 'data' isn't known error: 'mesg' undeclared (first use in this function) case PASS_STRUCT: struct mesg{ int pIDs[SIZE]; …
user340
  • 375
  • 12
  • 28
0
votes
1 answer

PInvoke DeviceIOControl for reading ISRC returns no data

I am using the sample Win32Functions Class by Idael Cardoso to interact with CD-Drive. I want to read the ISRC Code of a cd in the tray. First some Code - this is the Win32Functions Class - I added the hopefully correct code for reading the…
sebastian87
  • 454
  • 4
  • 15
0
votes
1 answer

About the /proc file system

I am using a command in the proc file system which is the following echo 0 > /proc/sys/net/ipv4/ip_forward Note: I don't want to know the basic of the command written above, I want what all happens when it goes inside the kernel. As, I want to…
Invictus
  • 2,653
  • 8
  • 31
  • 50
0
votes
1 answer

Passing a struct via IOCTL to kernel-mode driver

I'm trying to pass several distinct pieces of information to a kernel-mode driver from a user-mode application in Windows. I won't pretend to know fully what I'm doing, so if I have any fundamental misconceptions, clarification would be greatly…
wanovak
  • 6,117
  • 25
  • 32
0
votes
1 answer

non root access to ioctl for WIFI scan

I'm working on implementing iwlist python version. Here is a description of how iwlist works on Linux OS How does iwlist() command scans the wireless networks? what it does is to scan all nearby wifi access points, show a list of their ESSID, MAC…
Yanyan
  • 21
  • 1
  • 2