+ // Hotplug event (for devices being inserted between start_bm_thread()
+ // and stop_bm_thread()); entirely optional, but must be set before
+ // start_bm_capture(). Note that your callback should do as little work
+ // as possible, since the callback comes from the main USB handling
+ // thread, which is very time-sensitive.
+ //
+ // The callback function transfers ownership. If you don't want to hold
+ // on to the device given to you in the callback, you need to call
+ // libusb_unref_device().
+ static void set_card_connected_callback(card_connected_callback_t callback)
+ {
+ card_connected_callback = callback;
+ }
+
+ // Similar to set_card_connected_callback(), with the same caveats.
+ // (Note that this is set per-card and not global, as it is logically
+ // connected to an existing BMUSBCapture object.)
+ void set_card_disconnected_callback(card_disconnected_callback_t callback)
+ {
+ card_disconnected_callback = callback;
+ }
+