Adding HID joystick support to FreeBSD

Bruno Jesus 00cpxxx at gmail.com
Sat Mar 21 14:58:19 CDT 2015


On Sat, Mar 21, 2015 at 4:31 PM, Ken Thomases <ken at codeweavers.com> wrote:
> Hi,
>
> On Mar 21, 2015, at 1:06 PM, Bruno Jesus <00cpxxx at gmail.com> wrote:
>
>> In order to add HID joystick support to FreeBSD I need to do some
>> changes I never did before so I could use some help. I tried to
>> understand the changes made by Ken in order to add the winmm OSX
>> driver but I don't get it =)
>>
>> In simple words I need to ensure that usbhid.h and dev/usb/usbhid.h
>> exist and only if they exist compile the winejoystick driver. I
>> believe it's a change in configure.ac but I tried adding these .h
>> files to the long list of other .h files and it didn't work.
>
> Yes, you need to add the headers to the long list, similar to IOKit/hid/IOHIDLib.h (as used by the Mac code) and linux/joystick.h (for Linux).  That causes configure to check for the existence of those headers.  If they exist, configure will set the corresponding ac_cv_header_… variable.  The name of the variable will be ac_cv_header_ concatenated with the name of the header file with slashes and periods replaced by underscores.
>
>> Also I guess a similar change is needed like Ken did to enable the
>> driver building:
>>
>> -test "$ac_cv_header_linux_joystick_h" = "yes" ||
>> enable_winejoystick_drv=${enable_winejoystick_drv:-no}
>>
>> +test "$ac_cv_header_linux_joystick_h" = "yes" -o
>> "$ac_cv_header_IOKit_hid_IOHIDLib_h" = "yes" ||
>> enable_winejoystick_drv=${enable_winejoystick_drv:-no}
>
> Right.  That line is a bit complex.  The short version is that you would add another "-o" followed by a check for the new ac_cv_header_… variable being equal to "yes".
>
> The test command is checking if the configure variable indicating the presence of either of those headers is equal to "yes".  If either is, then the "test" command succeeds (exits with status 0, which means true).  The test command is followed by the shell's OR operator ("||").  If either operand of the OR is true, then the whole expression is true.  Therefore, once the test command has succeeded, there's no need to run the other command and the shell does not.  The effect is to only run the second command if the test fails.
>
> The second command sets the enable_winejoystick_drv variable to "no" if it has not previously been set.  It's only determining the default value.  If the user specified --enable-winejoystick-drv on the command line, that overrides this logic.  (Actually, it is overridden if the user specified any of --enable-winejoystick-drv, --disable-winejoystick-drv, or --enable-winejoystick-drv=anything.)
>
> Later in configure.ac, WINE_CONFIG_DLL(winejoystick.drv) informs configure about the existence the dlls/winejoystick.drv directory and to treat it like other DLL directories.  It uses the enable_winejoystick_drv variable to decide whether to build it.
>
>
> Anyway, once you make the changes to configure.ac, you need to generate configure from that by running autoconf.  You'd then need to run the configure script as normal.  I think a "make" should then be sufficient.  It's possible you will need to force a rebuild of Makefile at the top level (rm Makefile ; make Makefile), but I think that should be automatic.
>
> If it's not working for you, what's going wrong?
>
> One final point: my recent changes added Mac joystick support to WinMM.  This is used by older games.  More modern games use DInput, which has separate joystick support code.  So, you may need to add support there, too, depending on what game you're trying to get working.

Thank you very much for all information, I'll try and report back if I
find any problems. I'm working in winmm because it's an easier starter
point.

> -Ken
>



More information about the wine-devel mailing list