Thanks! Found the CurrentlyConnectedDevice object.
For anyone else wondering, this works:
Code:
from calibre.devices.interface import currently_connected_device
from calibre.devices.mtp.driver import MTP_DEVICE
if isinstance(currently_connected_device.device, MTP_DEVICE):
mtp_device: MTP_DEVICE = currently_connected_device.device
books = mtp_device.books()
# do whatever else