0

With Valve releasing games on Linux, I have been playing a bit of Left 4 Dead 2 and Portal 2, and I noticed a small, but still sensible mouse lag (delay) when I don't enable the Raw mouse input option. Another game I have been playing on Linux, Starbound, also has a similar mouse lag on Linux only. I have been looking around for information about raw input, but I'm still a bit puzzled.

From what I've gathered (for example here), a common way of getting raw hardware input is to read the */dev/input/event** files. The catch is that on my system (Fedora 20) these files are only readable to the root group, and I didn't create a udev rule as mentionned in the linked post.

So my question is:
How does the game read raw input from the mouse? Is there another way than /dev/input?
Is there a cross-platform way to do it?

Bonus questions (I'm about to look it up by myself anyway =) ):
What OS mechanism provides "standard" input? e.g. What does the SDL or other library rely on to gather input from the hardware?

ps: Portal 2's Raw mouse input option doesn't actually work so far in the beta, which is why I've started looking around the matter. It does work in L4D2, though.

1 Answer 1

2

In Linux "Everything is a File", but that doesn't mean it's an actual "file" on your hard-drive which requires IOP's to the drive to read from.

There are various ways of getting the input from the mouse in Linux the most common one's are envdev and mousedev. You can also use the X window engagement system to read mouse input. For other devices like keyboards you got keydev for general USB deviced usbcore etc.

Rawinput means that the game/application read the raw input data from the device rather than getting the data after it has been processed by the operating system. When using "processed input" OS specific mouse settings such as acceleration, cursor speed and others that can affect the perceived behavior of the device will affect the pointer's behavior within the game.

You can notice this in Windows games/applications too, some games might use the OS default input interface, some might use DirectX(Which was(and is) intended to unify Sound, Graphics, and Input under a single API), some might access the mouse directly and handle all the calculations themselves.

In general it's all dependent on how much work you want to do, and how much control you want or need over the input. When dealing with raw input all the calculation in regards to position, acceleration and other factors need to be done within your app, if you don't want to deal with it you can let the OS/API you use do that and just tell you the relative change in position.

0

You must log in to answer this question.