Before I was aware of python-can, I wrote my own simple python module (
https://github.com/bggardner/canopen-rpi/blob/master/CAN.py) where my Bus class simply extended socket.socket (since I only cared about the socketcan bustype). This allows me to use the following code to listen to multiple busses. While I haven't dug into python-can very much, is there a way to accomplish this, as I can't put the python-can "bus" through a select, as it does not have a fileno() method. I would like to stop maintaining my module and just use python-can. Here's what it looks like with my module:
```
import CAN
import select
bus0 = CAN.Bus("vcan0")
bus1 = CAN.Bus("vcan1")
rlist, _, _ = select.select([bus0, bus1], [], [])
for bus in rlist:
msg = bus.recv() # Returns CAN.Message
```
My feeble attempt to do this with python-can is below:
```
import can
import select
bus0 = can.interface.Bus(channel="vcan0", bustype="socketcan")
bus1 = can.interface.Bus(channel="vcan1", bustype="socketcan")
rlist, _, _ = select.select([bus0.socket, bus1,socket], [], [])
for s in rlist:
if s == bus0.socket:
msg = bus0.recv() # Returns can.Message
elif s == bus1.socket:
msg = bus1.recv() # Returns can.Message
```
As you can see, this is quite messy, especially if more busses (or regular sockets) were involved. This is important, as I make a lot of protocol adapters to and from CAN, and need to monitor multiple busses/sockets "simultaneously". Suggestions?
Thanks!