device-driver

why am I getting an “implicit declaration of function 'ndo_get_stats' ” error?

我的未来我决定 提交于 2019-12-08 05:13:14
问题 I'm building a VERY SIMPLE kernel module for gathering some stats from the network card here's the code, I keep getting an error implicit declaration of function 'ndo_get_stats' . I'm not sure why... #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_INFO */ #include <linux/netdevice.h> /* Needed for netdevice*/ static int __init hello_start(void) { struct net_device *dev; printk(KERN_INFO "Loading Stats module...\n"); printk(KERN_ALERT "Hello

How usb OTG works(master/slave)

*爱你&永不变心* 提交于 2019-12-08 04:24:04
问题 A device has usb OTG Following is scenarios when a device connected to PC ,then device act as slave (how device knows it has to act as slave) when a device connected to printer ,then device act as master. (how device knows it has to act as master) what are the steps executed when device connected to OTG. how to implement this mechanism (in brief)? 回答1: The exact behavior of USB OTG devices is described in the specification you can find at usb.org. There is a PDF inside the zip called USB_OTG.

Driver load/unload fails if WinDbg attached with breakpoint

时光毁灭记忆、已成空白 提交于 2019-12-07 19:18:17
问题 I just started with driver development. For some experiments with loading, unloading and debugging I have written the following simple driver: #include <ntddk.h> void DriverUnload(PDRIVER_OBJECT pDriverObject) { UNREFERENCED_PARAMETER(pDriverObject); DbgPrint("Driver unloading\n"); } NTSTATUS DriverEntry( PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) { UNREFERENCED_PARAMETER(DriverObject); UNREFERENCED_PARAMETER(RegistryPath); DriverObject->DriverUnload = DriverUnload; DbgPrint(

using numpy.memmap to map a device file

大城市里の小女人 提交于 2019-12-07 17:00:56
问题 Is there a reason that opening a device file (rather than a regular file) using numpy's memmap shouldn't work? self.surface = np.memmap('/dev/fb1', dtype=np.uint16, mode='r+', shape=(320,240)) I'm working with a custom kernel module that adds a framebuffer device, which works fine with python's regular mmap module. But using numpy seems to hang the kernel's mutex on accessing the filesystem or something (I'm really not sure exactly what's happening). My question here is specifically is this

Producer consumer implementation in a block device driver?

眉间皱痕 提交于 2019-12-07 16:44:53
问题 I'm trying to implement a producer-consumer like situation in my block level driver (on linux kernel version 2.6.39.1). My block driver's make_request_fn receives a stream of struct bio from a userlevel application. On receiving these BIOs, they are queued up. Next, I create a new struct bio which will hold all the information present in the queued BIOs. This new "merged_bio" will be submitted only if there is a struct request slot available in the lower level driver's request_queue . In the

Get Rotation Speed of Disk Sample Code

孤人 提交于 2019-12-07 07:23:56
问题 Im not really good at VC++ but does anyone have a sample code to get the rotation speed of disk in a computer. I have been working on detecting SSD drives and one solution from researching all day was to get the rotation speed and since SSD have 0 rpm this might be the only way to detect SSD drive. 回答1: From google wmi ssd detect There is an NV cache manager interface used for ReadyDrive which is new to Vista. I think it is testing NV_FEATURE_PARAMETER's NVReadSpeed and NVWrtSpeed values.

why am I getting an “implicit declaration of function 'ndo_get_stats' ” error?

拟墨画扇 提交于 2019-12-07 06:57:26
I'm building a VERY SIMPLE kernel module for gathering some stats from the network card here's the code, I keep getting an error implicit declaration of function 'ndo_get_stats' . I'm not sure why... #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_INFO */ #include <linux/netdevice.h> /* Needed for netdevice*/ static int __init hello_start(void) { struct net_device *dev; printk(KERN_INFO "Loading Stats module...\n"); printk(KERN_ALERT "Hello world\n"); dev = first_net_device(&init_net); while (dev) { printk(KERN_INFO "found [%s] and it's [%d]\n

Can ndo_start_xmit() be called from atomic contexts?

你离开我真会死。 提交于 2019-12-07 04:48:27
Is ndo_start_xmit() called (or could it be called) from atomic contexts? Please provide documentation references. More specifically, is ndo_start_xmit() forbidden from directly doing any of the following: reading and writing a TCP socket? locking a mutex or semaphore? sleeping? calling kmalloc() without GFP_ATOMIC ? I did some simple tests, and at least the first 3 cases fail at least occasionally. Calls to ndo_start_xmit() driven by network operations involving less queueing seem to fail more often. If I do the above operations indirectly through a work queue, then the failures seem to go

In Linux, how do you use device_create within an existing class?

只愿长相守 提交于 2019-12-06 19:48:57
问题 Note: I'm listing this problem as it is today, I'm not opposed to changing the implementation (moving the creation of the class to a common area for example) if it makes things easier... I'm just not sure how to do it. :End Note I've got two linux kernel modules and I'm trying to update the /sys entries for them. Searching around on google and other sources, I've seen lots of code along the lines of: static dev_t MyDev; static struct class *c1; static int __init start_func(void) { ... MyDev =

Device driver API match error

僤鯓⒐⒋嵵緔 提交于 2019-12-06 17:02:46
问题 I've installed cyanogenmod on my galaxy 3. When developing in Eclipse, most apps seem to work okay. However, I've written an app that needs to access the gallery and every time I try to access it the app crashes with this at log cat: 02-03 19:05:42.054: D/libEGL(10279): loaded /system/lib/egl/libEGL_mali.so 02-03 19:05:42.059: D/libEGL(10279): loaded /system/lib/egl/libGLESv1_CM_mali.so 02-03 19:05:42.059: D/libEGL(10279): loaded /system/lib/egl/libGLESv2_mali.so 02-03 19:05:42.064: E/(10279)