Documentation ¶
Index ¶
- Constants
- func SetDiscSpeed(device string, speed int) error
- func StartMonitor(ctx context.Context, handlers []*EventHandler) error
- type EventHandler
- func (h *EventHandler) DeviceFilter(device *udev.Device) bool
- func (h *EventHandler) Name() string
- func (h *EventHandler) Process(ctx context.Context, device *udev.Device) error
- func (h *EventHandler) SetProcessor(wg *sync.WaitGroup, actionLog string, ...)
- func (h *EventHandler) StartSubscriber(wg *sync.WaitGroup, ctx context.Context)
Constants ¶
View Source
const ( CDROM_SET_SPEED = 0x5322 // ioctl command for setting speed CDROM_PROC_FILE_INFO = "/proc/sys/dev/cdrom/info" )
View Source
const ( EventAdd = "add" EventChange = "change" EventRemove = "remove" )
Variables ¶
This section is empty.
Functions ¶
func SetDiscSpeed ¶
func StartMonitor ¶
func StartMonitor(ctx context.Context, handlers []*EventHandler) error
Types ¶
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
func NewBasicDiscHandlers ¶
func NewBasicDiscHandlers() []*EventHandler
NewBasicDiscHandlers initializes two event handlers for "add" and "remove" disc events.
func NewBasicUSBHandlers ¶
func NewBasicUSBHandlers() []*EventHandler
func (*EventHandler) DeviceFilter ¶
func (h *EventHandler) DeviceFilter(device *udev.Device) bool
func (*EventHandler) Name ¶
func (h *EventHandler) Name() string
func (*EventHandler) Process ¶
func (h *EventHandler) Process(ctx context.Context, device *udev.Device) error
func (*EventHandler) SetProcessor ¶
func (h *EventHandler) SetProcessor(wg *sync.WaitGroup, actionLog string, processor func(device *udev.Device) error, notifier *notifications.Notifier, event string)
func (*EventHandler) StartSubscriber ¶
func (h *EventHandler) StartSubscriber(wg *sync.WaitGroup, ctx context.Context)
Click to show internal directories.
Click to hide internal directories.