ioctl

imx6 视频多层分屏显示

别来无恙 提交于 2019-12-23 18:15:15
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> //main.c #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <stdint.h> #include <sys/types.h> #include <stdint.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #include <sys/time.h> #include <unistd.h> #include <asm/types.h> #include <linux/videodev2.h> #include <sys/mman.h> #include <math.h> #include <string.h> #include <malloc.h> #include <sys/time.h> #include <signal.h> #include "mxcfb.h" #include "ipu.h" #include "g2d.h" #define G2D_CACHEABLE 1 #define TFAIL -1 #define TPASS 0 #define NUMBER_BUFFERS 3 char v4l_capture

Adding new IOCTL's into kernel (number range)

萝らか妹 提交于 2019-12-23 16:41:31
问题 I'm writing new kernel module and I add implement new IOCTL's. Is there any rule that I should follow with IOCTL's numbering ? Maybe there is some "user range" ? I work with kernel 2.6.21 on embedded platform. 回答1: IOCTLs are defined to be device dependent -- if there were "standard" ioctls for people to implement, these would be syscalls like read and write . There are a few conventions for ioctl numbers: the parameter direction (in, out, both) is encoded in the ioctl number in two bits.

How to get windows size from Linux

戏子无情 提交于 2019-12-23 04:38:05
问题 everyone. I am still new to programming. I really need some help about the issues that I'm facing. So, the situation here is I'm trying to display a warning when the terminal size is below 80x24. For the record, my Os is Window, but I'm using a virtual machine to run Linux because all the files are in Linux. When i run the file using terminal, the warning display correctly. But the problem is when i try to run the file from Windows using PuTTY. The warning did not appear. I'm sure its because

After partition was created using IOCTL_DISK_SET_DRIVE_LAYOUT, how do I create new volume in this newly created partition?

。_饼干妹妹 提交于 2019-12-23 00:27:09
问题 I am trying to create a new partition, format it and assign it a new drive letter via Python ctypes, using IOCTL_SET_DRIVE_LAYOUT. My initial coding attempt was done using this SO page : Python ctypes structure being overwritten when allocating more memory. You can see the definition of class DeviceIoControl there. I successfully initialize the disk using IOCTL_DISK_CREATE_DISK, and create a new partition having certain size using IOCTL_DISK_SET_DRIVE_LAYOUT, below are the result in Disk

How to set the terminal's size?

為{幸葍}努か 提交于 2019-12-22 08:15:19
问题 How do I get the terminal size in Go. In C it would look like this: struct ttysize ts; ioctl(0, TIOCGWINSZ, &ts); But how to i access TIOCGWINSZ in Go 回答1: The cgo compiler can't handle variable arguments in a c function and macros in c header files at present, so you can't do a simple // #include <sys/ioctl.h> // typedef struct ttysize ttysize; import "C" func GetWinSz() { var ts C.ttysize; C.ioctl(0,C.TIOCGWINSZ,&ts) } To get around the macros use a constant, so // #include <sys/ioctl.h> //

Can someone help me replace “lock_kernel” on a block device driver?

*爱你&永不变心* 提交于 2019-12-22 05:21:57
问题 Thank you for looking at this post. I am trying to patch up a network block device driver. If you need to see the sources they are at http : / / code.ximeta.com. I noticed that lock_kernel() seems deprecated as of linux 2.6.37. I read "The new way of ioctl()" and found that device drivers now should perform a specific lock before operating. So I would like some advice replacing this if possible. I have found two sections in the current code that I think are related, in the block folder

Is it possible to call a user-space callback function from kernel space in Linux (ioctl)?

放肆的年华 提交于 2019-12-21 09:27:32
问题 Is it possible to expand the ioctl interface in Linux so that the user-space application can send a pointer to a function to the kernel space driver? I'm in particular thinking of ways to handle the stream in user-controllable way but doing it in the kernel. Those operations could be attached to the kernel module but this would make development a lot easier as I wouldn't need to mess with the kernel during development. More specifically, this would be the process: Data is read by the driver

what is the meaning of this macro _IOR(MY_MACIG, 0, int)?

不打扰是莪最后的温柔 提交于 2019-12-21 03:48:38
问题 i was going through ioctl sample programs to check how it communicates with kernel space. in program WRITE_IOCTL is used as command #define WRITE_IOCTL _IOW(MY_MACIG, 1, int) ioctl(fd, WRITE_IOCTL, "hello world") I am not able to understand what is _IOW(MY_MACIG, 1, int) . here is the link from where i downloaded the program. please help me. http://people.ee.ethz.ch/~arkeller/linux/multi/kernel_user_space_howto-4.html 回答1: As you may know, an ioctl should be unique, as explained in the Linux

char device catch multiple (int) ioctl-arguments

十年热恋 提交于 2019-12-19 04:09:32
问题 I have to write a linux char device, which handles ioctl (without BKL) functions per unlock_ioctl. At the moment I can receive one argument from the userspace ioctl command per __get_user(myint, (int __user *) arg); How can I receive multiple int-arguments (for example this call)?: ioctl(fp, SZ_NEW_DEV_FORMAT, 0, 1, 30); 回答1: Yes, you have to use structures. For a particular ioctl command there will be some predefined arguments. You need to wrap these all arguments into a structure object and

Setting Immutable Flag using ioctl() in C

人走茶凉 提交于 2019-12-18 07:05:10
问题 I have attempted to make a script that creates a file and then sets it as immutable similar to the chattr +i command for linux. The script compiles (with gcc), runs and the file is created . However the file itself is not immutable and can be removed with a simple rm -f . I have attempted to stacktrace where chattr is called and I found a function called ioctl . I then used what little information I could gather and came up with what I have below. I narrowed it down from ext2_fs.h but it just