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.
Questions tagged [ioctl]
691 questions
0
votes
1 answer
Get USB disk drive letter by device path or handle
My goal is to write a c-dll (compiled with MinGW) that is able to search for certain models of USB sticks connected to the computer and deliver the serial number, the vendor ID, the product ID and the drive letter.
I have searched on the internet…

fotten
- 46
- 1
- 8
0
votes
1 answer
DeviceIoControl for SCSI INQUIRY command returns error 50
I am trying to access a USB scanner through the IOCTL commands. This is on Windows 7. I did not deal with IOCTL coding before, so I first tried the following snippet based on what I could find with a quick search.
#include "stdafx.h"
#include…

alokoko
- 1,405
- 4
- 21
- 35
0
votes
0 answers
How to set DeviceIoControl (IOCTL)?
Have anyone experience using "DeviceIoControl", this functions seems to be a way an application can do IO control (IOCTL) which is generally set for Driver for example:
IOCTL_SERIAL_SET_QUEUE_SIZE
IOCTL_SERIAL_SET_LINE_CONTROL …

Satya Sankar
- 51
- 7
0
votes
1 answer
Error-handling in a kernel module
I'm writing a kernel module that communicates with a user application via ioctl. The communication is one-way only - that is, under normal circumstances no output is required. My question is - how should I report errors to the user application?
For…

Benesh
- 3,398
- 1
- 18
- 38
0
votes
1 answer
What is the difference between Non blocking and Asynchronous socket
What is the difference between Non blocking and Asynchronous socket modes that we set using below calls.
Case 1:
int sockfd;
// create_sock(sockfd);
// init_sock(sockfd);
fcntl(sockfd, F_SETFL, O_NONBLOCK);
Case 2:
int sockfd;
//…

akure
- 49
- 1
- 7
0
votes
1 answer
Tell proc_entry->write_proc to use an ioctl with an argument?
I've seen some sample code that does this:
proc_entry->read_proc = module_read;
proc_entry->write_proc = module_write;
However, in my module, I've used ioctls instead of the read and write. Here is my ioctl function prototype:
int…

hwrd
- 2,134
- 6
- 29
- 36
0
votes
2 answers
2D array that automatically adapts depending on the available size of the terminal in C
We ask your help to resolve a little problem that we couldn't find the solution. We have to create an 2D-array to make a shooter game. We would create an 2D array that automatically adapts depending on the available size of the terminal, like if the…

user3584484
- 39
- 4
0
votes
1 answer
What happens during an ioctl/syscall done in thread while another thread is forking?
I've read that a lot can happen when mixing threads and forking and it should better be avoided. I'm finding myself in a situation where I don't have a choice and I receive a kernel-crash of my kernel-module.
My reduced test-case has 2 threads. One…

Patrick B.
- 11,773
- 8
- 58
- 101
0
votes
1 answer
ioctl prototype in solaris libc
I had a program issue with the following stack.
6600: ora_d006_LOOKUP
ffffffff7addbbd0 __systemcall6 (3, ffffffff7d300440, 0, ffffffff7adc1268, d, fff7) + 24
ffffffff7adcba74 pthread_sigmask (2000, 0, 0, 0, ffffffff7d300200, d) + 1c4
…

zhihuifan
- 1,093
- 2
- 16
- 30
0
votes
1 answer
IOCTL: invalid argument for HDIO_GET_IDENTITY
I wrote a program to get the details of hard disk drive using HDIO_ ioctl calls.
For writing program, I'm referring Documentation/ioctl/hdio.txt in kernel source(2.6.32).
Here is my main part of code:
unsigned char driveid[512];
fd =…

gangadhars
- 2,584
- 7
- 41
- 68
0
votes
0 answers
SIGABRT in __ioctl() while waiting for /dev/binder response
Pre-requisites: ARMv7 device, Android platform 4.2.2.
Time to time I get SIGABRT upon interaction with a system service (a really buggy one) over a binder. The stack trace is as follows:
#00 pc 000170ac /system/lib/libc.so (__ioctl+8)
#01 pc…

LXE
- 11
- 3
0
votes
1 answer
How do i know if a IOCTL code is valid or not from DeviceIoControl Return Value
I'm writing prog. which communicates with a Kernel driver using DeviceIoControl().
For different IOCTL codes, DeviceIoControl returns sometime -0x3ffffff3 and sometime -0x3ffffffb. (Negative values in both cases)
From this return value how do i…

Dev.K.
- 2,428
- 5
- 35
- 49
0
votes
1 answer
Linux device driver atomic GET then SET via ioctl
I would like to read a structure from a device driver via an ioctl, change a value in the structure in userspace and then write it back. Is this possible to do atomically without some other process changing the structure inbetween read and…

wilysloth
- 41
- 3
0
votes
1 answer
How to fetch "Track Information" from a CD with DeviceIOControl()?
I am trying to use DeviceIoControl() with SCSI_PASS_THROUGH_DIRECT, in order to fetch TRACK_INFO.
this code "works" but it comes back by setting ScsiStatus to 2.
There seems to be conflicting documentation on the size of the "track" data field. the…

David M. Cotter
- 136
- 9
0
votes
1 answer
Not able to access the struct array from the user space app
In a common header, I am defining the struct as:
#define query_arg_t queryForItems
typedef struct {
char item[50];
char status[10];
} queryForItems;
In the kernel driver, we define:
// initialize
queryForItems queryForItemsArray[] =…

Moirisa Dikaiosýni
- 330
- 3
- 20