simplest way to detect USB drive when inserted?

In my project I have a single board PC inside a special device.
The PC is running an Ubuntu Linux variant.

The device has a USB port where the user can plug a usb drive and play back animations with Panda on the device.

There are some Linux specific code online for monitoring USB devices, but are there simpler solutions?
Since only one fixed port is accessible by the user, maybe there exists some Python or Panda function I could put in a task and check eg. each second if “drive F” exists and if yes scan the folders?

Hmm, I’m not aware of any such function, but for a simple Linux-only solution you could do a periodic listdir on one of the /dev/disk/by-*/ directories, which contain symlinks to the devices. Otherwise you could look into a libusb binding like PyUSB.

Thanks, I’ll have a look.