Usb Input Device Driver

1 view
Skip to first unread message

Elenio Guardado

unread,
Aug 5, 2024, 9:04:06 AM8/5/24
to hairiacerli
NewishCorsair 1080Ti owner here, i had this in Device Manager for a while now about not having compatible drivers for a "Corsair Virtual Input Device" and just recently got another one named "Nautilus".

No prob, I just wanted to make sure we tried that already. Can you provide a screenshot of what you're seeing in device manager? I'll forward this to the product team to see what could be causing this.


If you don't see your Microphone in the Port selection under the input devices in pavucontrol:use pavucontrol -> configuration -> built_in Audio. Check if you have * Output + * Input choosen in your profile, otherwise your microphone isn't shown in the input devices section and cannot be used.


I had the same problem. I found the solution after I upgraded to 16.04, but I think it works on 14.04 too! In Skype click "Open PulseAudio Volume Control". From there on move to "Input Devices" and change the Port. By some miracle my microphone started working after I changed my port to "Microphone (unplugged)". Good luck!


For me everything looked correct, input device was selected correctly however I was unable to use the inner or the external mic. I solved it by enabling the webcam using the Fn keys. Apparently they are enabled and disabled by the same Fn key.


Then it allocates a new input device structure with input_allocate_device()and sets up input bitfields. This way the device driver tells the otherparts of the input systems what it is - what events can be generated oraccepted by this input device. Our example device can only generate EV_KEYtype events, and from those only BTN_0 event code. Thus we only set thesetwo bits. We could have used:


This adds the button_dev structure to linked lists of the input driver andcalls device handler modules _connect functions to tell them a new inputdevice has appeared. input_register_device() may sleep and therefore mustnot be called from an interrupt or with a spinlock held.


Note that input core keeps track of number of users for the device andmakes sure that dev->open() is called only when the first user connectsto the device and that dev->close() is called when the very last userdisconnects. Calls to both callbacks are serialized.


Inhibiting a device means ignoring input events from it. As such it is aboutmaintaining relationships with input handlers - either already existingrelationships, or relationships to be established while the device is ininhibited state.


Inhibiting and uninhibiting are orthogonal to opening and closing the device byinput handlers. Userspace might want to inhibit a device in anticipation beforeany handler is positively matched against it.


See uapi/linux/input-event-codes.h for the allowable values of code (from 0 toKEY_MAX). Value is interpreted as a truth value, i.e. any non-zero value meanskey pressed, zero value means key released. The input code generates events onlyin case the value is different from before.


However EV_ABS requires a little special care. Before callinginput_register_device, you have to fill additional fields in the input_devstruct for each absolute axis your device has. If our button device had alsothe ABS_X axis:


This setting would be appropriate for a joystick X axis, with the minimum of0, maximum of 255 (which the joystick must be able to reach, no problem ifit sometimes reports more, but it must be able to always reach the min andmax values), with noise in the data up to +- 4, and with a center flatposition of size 8.


The id* fields contain the bus ID (PCI, USB, ...), vendor ID and device IDof the device. The bus IDs are defined in input.h. The vendor and device IDsare defined in pci_ids.h, usb_ids.h and similar include files. These fieldsshould be set by the input device driver before registering it.


These three fields should be used by input devices that have dense keymaps.The keycode is an array used to map from scancodes to input system keycodes.The keycode max should contain the size of the array and keycodesize thesize of each entry in it (in bytes).


They are very similar to for example key events, but they go in the otherdirection - from the system to the input device driver. If your input devicedriver can handle these events, it has to set the respective bits in evbit,and also the callback routine:


My application needs to behave as a virtual joystick (imagine dragging a square with the mouse and translating that to the output of an analog joystick) and send some keystrokes over the network to another computer where the driver would receive that input.


If it involves making custom hardware to control the analog joystick (like it controls pneumatics or hydraulics or something, not just a pc game joystick type thing), then yes, you will almost certainly need a driver to allow a network app to move (the robot arm, or whatever) will move that joystick.


If you are able to remove the physical joystick from the equation, maybe you can write software that emulates the input of wherever the joystick used to plug into (a joystick/serial port?), or emulates it completely (a reasonably simple driver could do this). You could do it completely without writing a driver if the joystick used a standard communication interface (like RS232) because libraries exist that will handle all that and you can set up virtual COM ports that will be indistinguishable to whatever you are trying to communicate with.


Rootkits: Subverting the Windows Kernel is another great book, but doesn't cover a lot of the newer WDF stuff. It has more of a security focus but has a few awesome chapters on device drivers with fully spoonfed examples, breaking it down in a really accessible way.


I have a BLE device containing a custom GATT service, of which I cannot modify the firmware. I want to listen for the GATT characteristic events from that service, and make Windows consume them as HID reports to make Windows recognize it as another device. How would I go about doing this?


I really appreciate that Alain took the time to answer the question and therefore I marked his answer as answer to the question; however for me the question is not completely answered yet. Seeing that the question already got more than 10 votes, I think it deserves a more extensive answer. Points that could be improved / added are:


I suppose that Alain recommended a UMDF HID minidriver over VHF because VHF requires writing a KMDF driver. UMDF has the benefits of easier debugging (can be debugged on local pc), less security (and signing) restrictions and no risk of bugchecking a machine when there is a bug in the driver.


In order to make it possible to create a client application that injects RadialController events (rather than having to write a driver which is a very high barrier for private developers), I posted a request for it on Feedback Hub. Please consider voting for it if you think that is worth supporting.


The best approach to this would be to create a UMDF HID driver ( -us/windows-hardware/drivers/wdf/creating-umdf-hid-minidrivers) that installs on the bthleenum device node that is created for the device's custom service and use the new Bluetooth LE UWP apis ( -us/uwp/api/windows.devices.bluetooth.genericattributeprofile).


There is some ambiguity about the use of UWP Apis from non store application, but this is incorrect. These Apis are usable in pretty much every conditions. In case you need help setting up your project, here is a C++/UWP sample that can help you get started.


Hey guys, I'm not sure if this is possible within DCS, but I have an input device for which I can access the data via C++. It does not present itself as an HID / joystick-like device. I am trying to figure out how I can interface with DCS, so that my input device can emulate the function of a mouse clicking on interactable elements in cockpits. Ideally, I could get DCS to simply read it as though it were an actual mouse sending clicks.


I've already looked into emulating a mouse at the system level, which can be done but requires writing a Windows driver for a virtual device. Distributing this for 64-bit systems would require paying several hundred dollars to have the driver digitally signed before Windows will allow people to install it. Hopefully I can find another way to make this work.


If you don't want to write the HID code stuff by yourself, you can simply get an arduino board and flash it with a joystick HID firmware. You can write there a simple program to read data from your input device and "send" it to the virtual joystick very easily.


That's a really interesting option. But, I would be a little concerned about latency. Also, I want to distribute this software, and I don't want every user to have to purchase hardware in order to make it work.


I can write the virtual device driver myself, I just then run into the issue of getting it digitally signed so that I can distribute it to others. I may go ahead and do that and then make a kickstarter or something to raise part of the funds if there is enough enough interest.


Some hardware is needed anyway unless you put some sort of microcontroller inside your custom gaming device. If so, you can use a board like Beaglebone Black (that has an ethernet port and a usb port), flash it with linux, get data from DCS export.lua via network (UDP) and use one one the many HID driver/library.


Yep, actually I did a lot of reading and digging through their code to see how they do things. It's been really valuable for understanding how I can get what I need to do working. Still hoping not to have to go that route though.


That's what I'm hoping I can discover here. If there's were a way in lua to effectively do the same thing as you would do with the mouse- sending click events in screen space, that would probably be ideal. Still, I'd have to be able to load a dll or something because I cannot access my input data with just lua.

3a8082e126
Reply all
Reply to author
Forward
0 new messages