I'm currently working on a project that involves an Up-board running ubilinux connected to three usb devices. We have witnessed issues where the board sees the usb device disconnect. When the usb device reconnects, it loads the USBSerial and FTDI_sio module, which is an issue. Before the program can check for the presence of the connected devices I need to run
sudo /sbin/rmmod usbserial
sudo /sbin/rmmod ftdi_sio
I don't want the program to constantly perform those operations, so what I've done is created a thread that looks for a usb device being plugged in. I'm using pyudev to accomplish this.
My issue is that I don't always have to perform the rmmod for usbserial and ftdi_sio, as they don't always load when the usb device is attached. Is there some way to run a check, written in python, to determine if ftdi_sio and usbserial have loaded?
I've done a number of searches and I find a number of links that show how to do it as a bash script, but I'm trying to find out if I can do it in python. I also seem to get a large number of search results for loading python modules, which isn't very helpful.