device-driver

where is device driver code executed? Kernel space or User space?

女生的网名这么多〃 提交于 2019-12-03 02:46:13
Part1: To the linux/unix experts out there, Could you please help me understanding about device drivers. As i understood, a driver is a piece of code that directly interacts with hardware and exposes some apis to access the device. My question is where does this piece of code runs, User space or Kernel space? I know that code that is executed in kernel space has some extra privileges like accessing any memory location(pls correct if i'm wrong). If we install a third party driver and if it runs in kernel space, wouldn't this be harmful for the whole system? How any OS handles this? Part2: Lets

How to learn the structure of Linux wireless drivers (mac80211)?

两盒软妹~` 提交于 2019-12-03 02:10:59
问题 There is so many structures in the Linux wireless driver mac80211. Things like struct net_device , struct ieee80211_hw , struct ieee80211_vif and struct ieee80211_local and so on. So many structures that I don't understand what information they contain and when them were initialized. How can I learn about them and the whole architecture of wireless drivers? 回答1: You may want to check out Johannes Berg's (mac80211 maintainer) slides here: http://wireless.kernel.org/en/developers/Documentation

Memory mapped IO - how is it done?

左心房为你撑大大i 提交于 2019-12-03 00:35:14
问题 I've read about the difference between port mapped IO and memory mapped IO, but I can't figure out how memory mapped Io is implemented in modern operating systems (windows or linux) What I know is that a part of the physical memory is reserved to communicate with the hardware and there's a MMIO Unit involved in taking care of the bus communication and other memory-related stuff How would a driver communicate with underlying hardware? What are the functions that the driver would use? Are the

Programming a USB transfer cable / talking to a USB device driver

帅比萌擦擦* 提交于 2019-12-03 00:34:56
How do I programmatically access a USB transfer cable (such as Belkin's Easy Transfer Cable ) from Windows? I'm familiar with libusb-win32 , but from what I can tell, using that with newer devices and with Windows Vista seems iffy. I know that Windows Easy Transfer can do this. How do I write code that does the same thing as Windows Easy Transfer? If there is no canned documentation on how to do this, I'm willing to do some digging, but I don't know where to start. How do I watch what Windows Easy Transfer is doing to find out how it does it? I see that Windows even gives transfer cables their

How to Install Driver with a cat file?

扶醉桌前 提交于 2019-12-02 19:04:49
I have kernel driver. When installing on 32 bit systems and Windows XP and below, I had no problem and used SetupCopyOEMInf, but 64 bit drivers are required to be signed. I have signed it and I need to have a cat file with the driver copied somewhere on the computer, and this method of install doesn't work. How should I install it? EDIT: Clarified the question. SurDin In Windows Vista and Windows 7 there a new utility for handling drivers setup call PnPUtil . It handles exactly this kind of work. Just copy all your driver relevant files(*.inf, *.cat, *.sys) to a directory on the target

Raw PDO to send IOCTL to upper filter driver (kbfiltr/moufiltr) to enable/disable device

和自甴很熟 提交于 2019-12-02 16:47:05
I am quite new to driver development and trying to write a simple filter driver that will enable or disable a keyboard or mouse device. If I can make it work, I want to use it to disable the touchpad on my laptop when a mouse is plugged in. I realize there is probably software out there that does this already, but I am really interested in device drivers and want to learn how to do this myself. I am using the kbfiltr and moufiltr examples that ship with the WDK, installed as upper filter drivers. The kbfiltr example creates a pdo which can be enumerated and connected to by a usermode program.

How to learn the structure of Linux wireless drivers (mac80211)?

烈酒焚心 提交于 2019-12-02 14:19:35
There is so many structures in the Linux wireless driver mac80211. Things like struct net_device , struct ieee80211_hw , struct ieee80211_vif and struct ieee80211_local and so on. So many structures that I don't understand what information they contain and when them were initialized. How can I learn about them and the whole architecture of wireless drivers? eyalsh You may want to check out Johannes Berg's (mac80211 maintainer) slides here: http://wireless.kernel.org/en/developers/Documentation/mac80211?action=AttachFile&do=get&target=mac80211.pdf They may be somewhat outdated but should give

Memory mapped IO - how is it done?

旧城冷巷雨未停 提交于 2019-12-02 14:07:06
I've read about the difference between port mapped IO and memory mapped IO, but I can't figure out how memory mapped Io is implemented in modern operating systems (windows or linux) What I know is that a part of the physical memory is reserved to communicate with the hardware and there's a MMIO Unit involved in taking care of the bus communication and other memory-related stuff How would a driver communicate with underlying hardware? What are the functions that the driver would use? Are the addresses to communicate with a video card fixed or is there some kind of "agreement" before using them?

about /proc read and write functions

帅比萌擦擦* 提交于 2019-12-02 12:00:26
I have written a module to read and write from /proc file. the code is showing warnings as commented and shown after the code.the code is as follows: #include<linux/module.h> #include<linux/init.h> #include<linux/proc_fs.h> #include<asm/uaccess.h> #define proc_fs_max 1024 #define proc_entry "my_test" static struct proc_dir_entry *our_proc_file; static char procfs_buffer[proc_fs_max]; static int proc_buffer_size = 0; int proc_read(char *buffer,char **buffer_location,off_t offset,int buffer_length,int *eof,void *data) { int ret; printk(KERN_ALERT"\n in read function"); if(offset > 0){ ret = 0; }

Linux Kernel: copy_from_user - struct with pointers

寵の児 提交于 2019-12-01 16:52:26
I've implemented some kind of character device and I need help with copy_ from_user function. I've a structure: struct my_struct{ int a; int *b; }; I initialize it in user space and pass pointer to my_struct to my char device using 'write' function. In Kernel's Space character device 'write' function I cast it from a *char to this kind of structure. I alloc some memory for a struct using kmalloc and do copy_from_user into it. It's fine for simple 'int a', but it copies only pointer (address) of b value, not value pointed by b, so I'm now in Kernel Space and I'm working with a pointer that