Rawinput, RAWINPUTDEVICELIST and duplicate devices and some other questions

Started by
1 comment, last by joe_bubamara 16 years, 2 months ago
As name of the topic says I am playing around with rawinput. I want to make a multiplayer game the kind of where ppl sitt together in front of same screen and play. Yeah - as you do on consoles. I can get info and read/write HID devices either through HidD (& HidP) functions (except mouse and kbd of course which are system exclusive), or through RID functions. Since windows anyway takes exclusive right on kbd and mouse, I am doing everything through rid functions. There is also a lot of work already done compared to what one has to do with HidD functions. But problem is enumeration with Get_RawInputDeviceList. I Get kind of many duplicated devices, but that seems allright since some are "composites". After some playing I can manage to get rid of duplicated mices and joysticks, however keyboard is a pleague. There is 1 extra hid kbd no matter what I do. I have checked regkeys for HID and USB and in all of them there are multiple entries for same physical device. With different pids of course and even different name strings: one says "Logitech Gaming Keyboard", another says "G15 Keyboard". As u guess I have logitech g15 keyboard (+ ps2 dell keyb which also shows up with "Logitech" string, but that is not a problem). Even control panel -> keyboards shows 3 keyboards. I have tested to uninstall hid ones and then plug the g15 kbd in again, but after system installed it back, it was 2 of them again :). Now how to filter device list of that one extra? I have been googling around and checking different api's and forums for days. There seems to be 3 different tutorials around, one for two keyboards, one for two mouses (by mouse party) and one for media center remote, and everyone seems to chew those 3 tutorials around as much as they can. But for now anything I had tryed didn't sorted out devices correctly.
Advertisement
Quote:Even control panel -> keyboards shows 3 keyboards.


This means that there is a bug somewhere; probably in the Logitech installer. No big surprise there. You _may_ be able to remove the problem by unplugging all keyboards, then going to the Device Manager and showing inactive devices, and removing all keyboard devices, then re-installing the Logitech CD for the G15, then re-plugging the keyboards.

The alternative would be to kill your registry hive and re-install Windows. Not pleasant.

Or you could just look at all the keyboards, and ask player 1 "press space now," then player 2 "press space now," and "learn" which player uses which keyboard.
enum Bool { True, False, FileNotFound };
Quote:Or you could just look at all the keyboards, and ask player 1 "press space now," then player 2 "press space now," and "learn" which player uses which keyboard.
Yeah - of course I have already thaought of similar solution, but it is a matter of pcinciples to get solutions for this :-).

The thing is that I can sort out all devices corectly when using HiD functions alone. I am not 100% sure, but I believe that DIGCF_PRESENT when you call SetupDiGetCalssDevs solves the problem:

devinfo=SetupDiGetClassDevs (&guid, 0, 0, DIGCF_PRESENT|DIGCF_INTERFACEDEVICE);

However you can not use it when using RID functions. Or maybe one can, I am not sure device info obtained by GetRawInputDeviceInfo is maybe same as one got above, I will test it later. Mybe one can compare those and see which one is missing and that way sort out extra device.

Anyway one could have used capabilities of device to sort out things (maybe), but for that one needs preparsed data (whatever it is to m$). I tryed using preparsed data with GetRawInputDeviceInfo, but it seems not to work, despite msdn docs telling otherwise.

This topic is closed to new replies.

Advertisement