driver

2 Mice, capturing exclusively one mouse on windows (DirectInput, DDK, Linux, anything)

醉酒当歌 提交于 2019-12-11 09:08:43
问题 I have connected 2 mice to PC and I wish one mouse to work as regular mouse and capture second mouse exclusively. First I was trying DirectInput. It showed 2 devices with word mouse in InstanceName. But only one device had DeviceType.Mouse and it was only really working device. When I was acquiring it was blocking both mice. Second I decided to create driver. I downloaded WinDDK. There is Mouse Filter driver sample. I was able to compile it. But I am not driver programmer. It is complex for

Reach kernel session space from kernel driver

冷暖自知 提交于 2019-12-11 08:25:58
问题 I'm writing a kernel driver, which should read (and in some cases, also write) some memory addresses in kernel session space (win32k.sys). I've read in another topic that for example in Windbg I should change the context to a random user process to read the memory of kernel session space (with .process /p). How can I do that in a kernel driver? Should I create a user process which communicate with the driver (that's my idea now, but I hope that there is a better solution) or there is a more

Reset FPGA based PCIe card and restore its Config Space

陌路散爱 提交于 2019-12-11 08:24:08
问题 I am adapting a Windows / Linux driver of a FPGA based PCIe card. (using a LatticeECP3 with PCIe Endpoint) I need to add a driver function to allow a host driven bitstream update of the FPGA without the need of rebooting the host afterwards. I.e. after flashing I would need to reset the FPGA to let the bitstream be reloaded. This of course would lead to a loss of the Config Space settings of PCIe endpoint. My first approach was to implement following steps: Save the PCI config space of the

Which KPI Library Is IODeviceMemory Declared In?

旧街凉风 提交于 2019-12-11 07:34:44
问题 Google yields no insight. I wasn't able to figure it out by searching around in the kernel source. I'm using the open source IOProxyVideoFamily to implement a virtual framebuffer. I just replaced a C-style cast to IODeviceMemory with OSDynamicCast, because I suspect that cast will fail. If so I will know how to fix it. But I can't find the KPI library that contains it. IODeviceMemory has been in the OS since 10.0, and is required for PCI card drivers. $ kextlibs -undef-symbols /System/Library

Why does DeviceIoControl fail with “Incorrect Function”

心已入冬 提交于 2019-12-11 05:39:43
问题 I am trying to communicate with my USB driver. I am able to get a handle, but once I use DeviceIoControl it fails, GetLastError() says error is an incorrect function. I am stumped on how to debug this. I am using XP 32bit machine. Handle = CREATEFILE( DevicePath1, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if (INVALID_HANDLE_VALUE == Handle) { printf("INVALIDHANDLE USB\n"); return PHNFCSTVAL(CID_NFC_DAL, NFCSTATUS_INVALID_DEVICE); } else {

wake_up_interruptible() is not waking up the processes sleeping on condition

百般思念 提交于 2019-12-11 05:38:39
问题 I am writing a sleepy driver. Here any process that tries to write to the device file should sleep for 'n' number of seconds supplied by the user. Reader process should wake up all the waiting processes. Writer code : printk("Invoking interruptible_timeout for device flag[%d] = %d\n", idn, flag[idn]); long ret = wait_event_interruptible_timeout(wq[idn],flag[idn]==1,sec*HZ)/HZ; //flag[idn]=0; printk("timeout returned : %d idn = %d\n", ret, idn) printk("writer : flag[%d] = %d\n", idn, flag[idn]

Windows Kernel Driver: Does the “HANDLE UniqueThread” in “CLIENT_ID CreatingThreadId” is the same during the process loading?

空扰寡人 提交于 2019-12-11 05:08:33
问题 I'm trying to write an APC dll injection driver, I've found this example and thought to modify it to my needs. After I understood the code, this is how I thought to modify it (and my question come from there). In the code, the writer used PsLookupThreadByThreadId to receive a referenced pointer to the ETHREAD structure of the targeted process. PsLookupThreadByThreadId(pSpi->Threads[0].ClientId.UniqueThread,&Thread) but to get the SYSTEM_THREAD_INFORMATION for the UniqueThread handle, he used

Serial number enumeration failed when we cast Descriptor+Descriptor->SerialNumberOffset

若如初见. 提交于 2019-12-11 04:48:12
问题 I have a kernel driver which is used to find the serial number of storage devices, but there is an issue with the driver. Descriptor->SerialNumberOffset is 103 but (LPCSTR)(UINT_PTR)Descriptor+(DWORD32)Descriptor->SerialNumberOffset is NULL here is my code NTSTATUS GetDeviceTypeAndUniqueID(IN PDEVICE_OBJECT StorageStackDeviceObject, cwDevices *lDeviceTypeArg, char *pszUidArg) { DWORRD lDeviceType=0; STORAGE_PROPERTY_QUERY Query; STORAGE_DEVICE_DESCRIPTOR Buffer[4]; NTSTATUS Status = STATUS

Integrate out-of-tree driver in kernel and rebuild yocto project image

一世执手 提交于 2019-12-11 04:44:41
问题 I have a question regarding best practices for Yocto Project. What i want to do is to add sources for a driver from github in kernel and rebuild the whole yocto image, but i am not sure what's the best way of doing that. I am thinking of two options possible here. Fork the kernel sources into my own repo, then add the driver sources, update the Makefile and Kconfig and provide my own defconfig file. (this definitely works) The second thing that crosses my mind is to use the initial kernel

Linux OTG port screwing up my other host port

落花浮王杯 提交于 2019-12-11 04:33:42
问题 I've got a Variscite VAR-SOM-MX6 running a Linux 3.0.35 kernel, with two USB ports. The first port is an OTG port connected to an external mini-OTG jack. The second is an internal host port going to a hub chip, and then to some other devices. If I've got an OTG cable plugged into the first port, telling it to be a host, then everything works fine. If I have a regular cable, or no cable at all, plugged in, then the second host port doesn't enumerate properly. There doesn't have to be anything