[dinput] initial support for BSD's usbhid joysticks

Vitaliy Margolen wine-devel at kievinfo.com
Sat Apr 26 09:57:28 CDT 2008


Christoph Frick wrote:
> From 7618ceb6941c0dffac9c48c1fa1aeb7e821673a2 Mon Sep 17 00:00:00 2001
> From: Christoph Frick <frick at sc-networks.com>
> Date: Sat, 26 Apr 2008 02:50:01 +0200
> Subject: [PATCH] Initial support for BSD's usbhid joysticks
> 
> Please consider this a tracer bullet. I had only time to test it with a
> 4-axis/4-button wheel in LFS in FreeBSD 7.0. I will take further tests using a
> flight stick and other games soon. But for now i just want to see, what others
> have to say about it.
> ---

Please use 4 spaces indentation, no tabs.

> +		snprintf(buf, MAX_PATH, FMT_UHIDDEVS, i);
> +		buf[MAX_PATH - 1] = 0;

snprintf always writes terminating '\0' character at the end of the string. 
You don't need to explicitly do that yourself.

> +		if ((fd = open(buf, O_RDWR | O_NDELAY, 0)) == -1) {
> +			TRACE("Unable to open %s read/write: %s\n", buf, strerror(errno));
> +			continue;
> +		}
Do you really have to open it read/write? Shouldn't read only be enough for 
not FF joystick?

The only way I can think of to remove code duplication is to create base 
joystick class. There were no reason for that with only 2 joystick drivers. 
With third one should really do it.

Vitaliy.



More information about the wine-devel mailing list