func (self *Monitor) Recv() (MonitorDevice, error) { for { udev_device := C.udev_monitor_receive_device(self.udev_monitor) if udev_device == nil { continue } // device var device MonitorDevice if err := device.fromUdev(udev_device); err != nil { return device, err } cAction := C.udev_device_get_action(udev_device) if cAction != nil { device.Action = C.GoString(cAction) } return device, nil } }
func (m Monitor) ReceiveDevice() Device { return Device{C.udev_monitor_receive_device(m.ptr)} }
// receiveDevice is a helper function receiving a device while the Mutex is locked func (m *Monitor) receiveDevice() (d *Device) { m.lock() defer m.unlock() return m.u.newDevice(C.udev_monitor_receive_device(m.ptr)) }