pilebones / go-udev

Simple udev implementation in Golang
GNU General Public License v3.0
95 stars 28 forks source link

Could it used as mdevd replacement? #15

Closed pwFoo closed 6 years ago

pwFoo commented 6 years ago

I use mdevd / mdevd-coldplug for coldplug and hotplug of devices.

Is it possible with go-udev too?

pilebones commented 6 years ago

Hello,

Thanks for your interest, I think it could be possible to replace mdev by go-udev depending on the complexity of your use case. Otherwise you should probably implement your use case using the API provided by go-udev.

go-udev allow to:

How do you use mdevd ?

pwFoo commented 6 years ago

I built a custom initrd based on busybox with a driver detection loop (bash command) and mdevd for device coldplug / hotplug to handle kernel modules at boot and run time to handle hdd, usb sticks, ...

At the moment I play with u-root (go based) and would need a way to load all the needed kernel modules during boot and os run time (usb hotplug events, loading needed kernel modules).

I'm new with golang. So I don't know which solutions available or could fit my needs and found your go-udev as possible way.

pilebones commented 6 years ago

Initially, go-udev has been developed from scratch to auto-detect at runtime a GPS device already plugged or when hot-plug or then when unplug; for this project still in development: https://github.com/pilebones/go-gpsd

I think it is not so different than your use case, you could inspire you by this implementation: https://github.com/pilebones/go-gpsd/blob/feature/deconnect-device/autodetect.go#L43

It is a little bit treaky if you are new with Go but not impossible :) I hope it could help you.

Anyway, feel free to ask another questions, I will do my best to react quickly and effectively.

pwFoo commented 6 years ago

Go is really interesting, but maybe an easier task would be better to start with it g I have to take a deeper look how it could be done and what should work for my case.

Thank you very much for answering my questions and helping here!

pilebones commented 6 years ago

To start with it "g" ...? Missing ending ?

Indeed, feel free to ask another questions if go-udev could answer to your use-case, your are welcome and good luck for your research.

At this time, I close this issue.