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
1 answer

Am I using ioctl correctly?

I'm writing an http server in python3.3, just to learn how to do this sort of thing. In my function that parses a request, I want to use fcntl.ioctl to get the number of bytes that I can read in the socket, and I only do this when I see a kevent in…
Broseph
  • 1,655
  • 1
  • 18
  • 38
0
votes
0 answers

obtaining scsi(including SAS and FC) hardisk model and serial number

I have recently been playing around with some hard drive stuff. Now what I want to do is print out the model and serial number of harddisk. Sata drives are very easy with ioctl. scsi on the other hand I have to send an inquiry command. I found a…
user2882307
0
votes
1 answer

Cannot read i2c device properly

I am trying to write an embedded qt application that reads the specific i2c rtc device. Here is my code to init i2c: int addr = 0x68; // The I2C address of the RTC sprintf(filename,I2C_FILE_NAME); if ((file = open(filename,O_RDWR)) < 0) { …
thehilmisu
  • 342
  • 1
  • 5
  • 13
0
votes
1 answer

netbsd ioctl for hard disk information

I can't seem to find a good comprehensive list of available ioctls for netbsd. I am looking to do some operations on harddisk (getting size, physical sector size, model). I have the code working in linux. It looks something like this, I removed…
user2882307
0
votes
3 answers

Gstreamer- failed to enumerate video formats and Inappropriate ioctl for device Error

I need to stream a video using gstreamer. After giving media-ctl commands correctly When I give this command LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so mplayer tv:// -tv driver=v4l2:device=/dev/video6 -vo png -fps 1 , it is successfully capturing…
Zafrullah Syed
  • 1,170
  • 2
  • 15
  • 38
0
votes
1 answer

Write Text and command keys to a TTY on Linux

im working on a keyboard injection for a /dev/tty device. The only thing i found out was using the TIOCSTI ioctl command to inject text into the buffer. As far as good, but i also need to submit the command i typed in. Is there a way to send command…
Markus
  • 33
  • 5
0
votes
0 answers

how to access a user space buffer from kernel

I'm developping a linux device driver, and I need to understand how to access a memory area allocated by the user. In details, for a 32-bytes buffer, the user calls: void *UserAddr; posix_memalign(&UserAddr, getpagesize(), 32); //allocation of the…
Michele
  • 131
  • 2
  • 11
0
votes
1 answer

how to install IOCTL man pages for STREAMS in ubuntu server?

in my system Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu man page for putmsg contains reference to STREAMS man page. Stevens refers the same entity as STREAMIO (p. 858), and this is what I've found…
wick
  • 1,995
  • 2
  • 20
  • 31
0
votes
2 answers

Sending value from kernel mode to user mode

I'm developing a kernel-mode driver for an Anti Virus program, but I've a problem in Drivers section I want to send a string value (For example "String") from Kernel-mode driver to user-mode application . can anyone help me to do this ?
Behrooz
  • 684
  • 1
  • 9
  • 19
0
votes
3 answers

How to get hard disk size in bytes on Windows 2000?

How can I get the exact size of the hard disk in bytes on the old Windows 2000? IOCTL_DISK_GET_LENGTH_INFO works fine for volumes, but not on physical disk handles (stuff at //./PHYSICALDISKx) on Windows 2000. (Works fine for physical drives from…
Calmarius
  • 18,570
  • 18
  • 110
  • 157
0
votes
1 answer

Sending IOCTL to 64bit machine in C#

I'm sending IOCTL's to my keyboard filter driver and the code is as follows: Guid GUID_DEVINTERFACE_KBFILTER = new Guid(0x3fb7299d, 0x6847, 0x4490, 0xb0, 0xc9, 0x99, 0xe0, 0x98, 0x6a, 0xb8, 0x86); IntPtr handle = SetupDiGetClassDevs(ref…
Aster Veigas
  • 866
  • 3
  • 13
  • 34
0
votes
2 answers

ethtool get permanent MAC address returns all 0's

I need to read permanent (burned-in) MAC address of network adapter. Since MAC address can be easily spoofed, I need to read the real one which is written on EEPROM. I need to do it using C++ on Linux. I tried using ethtool which is quite good and…
0
votes
0 answers

Can msleep inside ioctl cause incorrect mutex operation?

Inside my linux driver I have an ioctl dispatcher, and one branch uses msleep() function. static long p347_fpga_ioctl(struct file *filp, uint cmd, unsigned long arg) { long ret_code = 0; ... switch (cmd) { ... case…
Konstantin Utkin
  • 478
  • 1
  • 5
  • 16
0
votes
1 answer

valgrind error in ioctl() call, while sending an i2c message

valgrind is giving me the following error on the ioctl() line: I am not sure how I could avert such an error. ==2764== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) ==2764== ==2764== 1 errors in context 1 of 1: ==2764==…
nass
  • 1,453
  • 1
  • 23
  • 38
0
votes
1 answer

Setting ip on interface using C code

When i tried to set ip on usb0 interface(created due to USB gadget drivet) using ioctl in C code,it is throwing "permission denied" error.If i try to make usb0 "up" in C, it is showing "No such file or directory". Can anyone suggest me how to fix…
Djames
  • 61
  • 6