Closed tve closed 8 years ago
my idea was to add a new method to Driver: Prerequisites() []string
where a driver will not be loaded unless a driver with the name was loaded successfully. Then Pine64 only loads if a64 loaded. a64 only loads if allwinner loaded.
Right now the pins are always loaded via Processor drivers so there's no problem at the moment specifically for sysfs-gpio.
Obviously this assumes there's no driver name clash so it may be brittle but in general it's probably "good enough".
I'm fine with changing Init() to return ([]Driver, []error).
The Prerequisites()
function seems to be a necessity.
Right now the pins are always loaded via Processor drivers so there's no problem at the moment specifically for sysfs-gpio. If by "right now" you exclude the CHIP PR... Or do you have a solution for me?
The new allwinner / allwinner_pl split should make this clear now. What would need to be added is an allwinner_r8 or something like that for the extra functionality.
These are suggestions, a github issue seems to work well for discussion...
I'm wondering whetehr drvier.Type needs another level between processor and pin in order to insert the sysfs-driven detection of what's present on the platform. Downside is that his may be a linux-only concept. See the issues I have with CHIP and gpio pins.
In the current design, Init() returns the list of drivers. That makes sense when called from main to initialize stuff, but I can see other libraries calling that as well to get access to hardware since it's the only way to get 'em. So perhaps a different name might be more appropriate? DriverList()? Not sure...