[Vm-dev] quick request for a volunteer to implement device add/remove callbacks and processing

Eliot Miranda eliot.miranda at gmail.com
Wed Feb 10 18:20:26 UTC 2021


Hi All,

    I just added a variable to the Windows VM that tracks device additions
and removals via receiving WM_DEVICECHANGE messages.  On Windows this
allows plugins such as the SoundPlugin and CameraPlugin enumerating the
available devices on every API call/primitive invocation rather than only
when devices change.  This facility is also needed on Mac and would be
great to have on unix.

It turn out that on Mac it is also straight=forward to achieve.  See
https://stackoverflow.com/questions/9918429/how-to-know-when-a-hid-usb-bluetooth-device-is-connected-in-cocoa,
especially Vivek Gani's answer (2 upvotes).  It also turns out that much of
the necessary support code already exists in the Mac JoystickPlugin.
See platforms/iOS//plugins/JoystickTabletPlugin/HID*.

I wonder if any one has free time to do the work for the Mac to use
IOHIDManagerRegisterDeviceMatchingCallback &
IOHIDManagerRegisterDeviceRemovalCallback to provide a simple counter in
the core Mac VM which is incremented whenever a device changes, just like
the Windows implementation.  If not, no biggie I'll get to this eventually.

And if any unix and/or linux experts know how various unices and especially
linux approach this issue please respond here.  I've no idea if unix/linux
provide a good API here.

_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20210210/889235c6/attachment.html>


More information about the Vm-dev mailing list