Rahix / profirust

A PROFIBUS-DP compatible communication stack written in Rust
Apache License 2.0
23 stars 2 forks source link

linux: Gracefully catch device errors #14

Open Rahix opened 7 months ago

Rahix commented 7 months ago

Right now, the phy-linux panics when its device is not present/disappears/has other errors. Instead, we should find a way for the PHY implementation to gracefully report what has happened so the application can decide how to deal with the situation.

Most likely, the best solution is to define a PHY error type which bubbles up through the FdlMaster's poll() call.

Rahix commented 1 week ago

A related question is how to deal with device disconnects. For most real-world applications this is not relevant as a hardware RS485 won't ever disappear. But, for example, a USB device cannot be assumed stable. Should the PHY implementation auto-reconnect? Should this be the job of the application?