Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth mouse not detected #747

Closed
HerrBvomSee opened this issue Apr 16, 2017 · 6 comments
Closed

Bluetooth mouse not detected #747

HerrBvomSee opened this issue Apr 16, 2017 · 6 comments

Comments

@HerrBvomSee
Copy link
Contributor

I am restarting gamedev with Allegro5 on a new iMac and use primarily a bluetooth mouse (Logitech MX Master) which is working smoothly in all apps.
When I start my self written game, I call al_install_mouse() which fails, as it seems that it can not detect the mouse properly.
Attaching a USB mouse helps, but I do not want to have multiple mice connected to my machine just for development purposes.
The init order is

al_init()
al_install_keyboard()  

and then

al_install_mouse()

, which returns all the time with false, even with the properly (in terms of system usage) BT mouse attached.

The allegro.log returns

system I system.c:257 al_install_system [ 0.00000] Allegro version: 5.2.3 (GIT)
MacOSX I qzmouse.m:236 osx_init_mouse [ 0.00028] Detected 0 pointing devices
MacOSX I qzmouse.m:271 osx_init_mouse [ 0.00029] Device effectively has 0 axes and 0

@HerrBvomSee
Copy link
Contributor Author

HerrBvomSee commented Apr 16, 2017

Generated a patch for the issue - working at least on my machine. If this patch seems helpful, please review.
mouse_detect_patch.diff

@ghost
Copy link

ghost commented Apr 16, 2017

Thanks for the patch. I took a quick look and it looks OK (for my reference did you change just the top of the big code block, the patch is a little wonky...?) I'll take a look at applying it soon.

@HerrBvomSee
Copy link
Contributor Author

HerrBvomSee commented Apr 16, 2017

@goobliata thanks for your feedback. I add here the info I mentioned in the IRC related to the patch:

At first, kHIDUsage_GD_Mouse did not detect the bluetooth mouse. Using the kHIDUsage_GD_Pointer instead detects it (as it is a "lower level" pointing device (from what I read - can not find it anymore :( ... ))

To not break the old code, I thought to test on both types, at first the GD_Mouse to keep the standard "as-is". If this does not detect any devices, I will use the fallback of GD_pointer.
To use both searches I introduced a new function _get_matching_services to get the iterator

Also I changed the dictionary used for the search from kIOHIDPrimaryUsageKey and kIOHIDPrimaryUsagePageKey to kIOHIDDeviceUsageKey and kIOHIDDeviceUsagePageKey as the former ones only take ONE usage into account, so when you have a keyboard with mousepad, it might detect only the keyboard and neglects the mouse part, resulting in no mouse
so I hope the code does not break old stuff and just added an additional feature/fix :)

ah and yes, the upper part is changed only. The rest are just formatting changes, as the idention level has changed due to new function.

And to improve myself in generating/writing patches: what do you mean with wonky?

@ghost
Copy link

ghost commented Apr 16, 2017

Thanks for the clarification. I don't have a bluetooth mouse but I'll test with a USB mouse and a keyboard/trackpad combo. But by the look of it it hopefully shouldn't break compatibility.

@ghost
Copy link

ghost commented Apr 16, 2017

There's a pull request here if anybody wants to test it with a Bluetooth mouse before it gets committed #748

@ghost
Copy link

ghost commented Apr 19, 2017

Patch has been applied. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant