Joystick competition pro usb

Never heard of the BJoystick API. Is it comparable to the Linux Joystick API or more to the libevdev API? Just asking since you talk about /dev/joysticks and /dev/input .

The devices are not the API :slight_smile:

The API is described in the Be Book: https://www.haiku-os.org/legacy-docs/bebook/BJoystick.html

There are of course ioctls on the devices to access them directly, but this is private to the OS and not supposed to be used by apps directly. For completeness purpose, you read() the device and get an _extended_joystick worth of data from it. There is information on the joystick number of axes and buttons in the module info.

Interesting. Need to test this when I get home.

seems like my two usb controller can be detected. the play3 are a conversor usb port from playstation 2 plug, but now how can i use this two gameplds cause seems la mgba cant configure the buttons, it dont want to accept the commands… and joystickutilizer is very annoying to know if it is working. :slight_smile: what can i do, thanks for the ansewrs!

054c:0268 /dev/bus/usb/0/0 “Sony Corp.” “Batoh Device / PlayStation 3 Controller” ver. 0100
0583:a009 /dev/bus/usb/0/1 “Padix Co., Ltd (Rockfire)” “4-Axis,12-Button with POV” ver. 0100

Ok, as I’m home today and had some time to locate my gamepad:

  • Connect the gamepad
  • A /dev/joystick/usb/0 should appear
  • use “cat /dev/joystick/usb/0” in a terminal, a lot of chars should be printed
  • Press buttons and make sure the output from cat changes

If all these steps are passing, it is likely that your joystick will be working fine. We have sources for an old “joystick” preferences in Haiku, but it does not seem to be designed for USB joysticks - it is about old style game ports.

1 Like

IIRC, my old Saitek X52 Pro HOTAS joystick was recognized fine under Haiku.

ok in someway it seems to be detected cause all the character pop on terminal but then the changes are so random… that happen even without i need to press any button, it just show random characters all the time. with genius pad, and with what seems to be the playstation port it only show xxxxxxxx

So, it seems things are working ok at this level. If you have problems getting it to work in applications, it is time to report the problem to application developers.

can you recommend me a path to test all the things on the x64? cause i dont know what can support joysticks at this point… i really want to test, and the “utilizer” dont give any signal of life(maybe i just dont understand it.).

I wanted to test this a bit with my gamepad but I can’t link. Tells me BJoystick.GetDeviceName is missing symbol. It’s compiling so I’m astonished linking with ‘be’ and ‘game’ is not enough. What other library do I need?

EDIT: Ah… forget it. Played around with some names and ‘device’ seems to be the required library. Let’s see where this is going.

1 Like

please share it! :slight_smile:

here are not detected :frowning:

ohh now it do :smiley:

Tried to get it working but there’s a bug in the BJoystick API. The call GetControllerName() returns B_OK but the name BString is set to an empty string. This cause me quite some head-ache since an empty name gamepad did not show up.

EDIT: If I work around this name bug it’s doing actually quite well. Simple API to use. Not bad.

1 Like

Wow very cool it cool be very useful, it will be a good thing.

So great, i can play hermes with my usb competition pro joystick now.

GetControlerName() return the device_name field handed by the kernel device, which is usb_hid.
Seems that this fiield is not set anymore, which will be a bug introduced when usb_joy was deprecated maybe.

How looks the Joystick preference window with this controler detected ?

I could not find this window at all so I can not tell you I’m afraid.

You said usb_joy is deprecated. Does this mean BJoystick is deprecated or is it just something in the kernel unrelated to the API at all.

usb_joy was the old driver for joysticks, it was replaced by the new usb_hid driver which implements the same device interface. BJoystick works with either, as well as old-style gameport joysticks where available.

The joystick preferences is not included in the default image. I tried to build it but it did not seem to work with my USB gamepad (it lists the port, but seems to thnk it should run a “detection” process to use a specific driver for each type of joystick, as was the case on gameports).

IIRC, one have to edit some joystick description file, which is loaded by JoystickTweaker to enhance and set more user-friendly and defined names to device features.

EDIT: giving a look to JoystickTwearker source, it show that indeed the device name (which GetControllerName() returns) and others descriptions are loaded, when found, from a joystick description file that should be located in /boot/home/config/settings/joysticks/ (for an USB joysticks, that would be …/joysticks/usb/0 etc), with a syntax like this:

module =
(only usefull for old gameport-based joystick, usb sticks are dynamically detected by usb_hid kernel module
gadget =
(that’s your ControllerName string, by default a “2-axis” should be returned according API spec, but it’s not the case)

and those below, to statically declare stick features for gameport-based joysticks.
It’s useless for USB sticks are there info are dynamically retrieved from USB HID report

num_axes =
num_hats =
num_buttons =
num_sticks =

So, @dragon, try to create a /boot/home/config/settings/joysticks/usb/0 file with this content:

module = usb_hid
gadget = Here your gamepad controller name

(Beware, code expect gadget=<value…>, so space around the equal are mandatory)

and check if it change something.