Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Device.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (

/* Properties */
DevicePropertyUdi = DeviceInterface + ".Udi" // readable s
DevicePropertyPath = DeviceInterface + ".Path" // readable s
DevicePropertyInterface = DeviceInterface + ".Interface" // readable s
DevicePropertyIpInterface = DeviceInterface + ".IpInterface" // readable s
DevicePropertyDriver = DeviceInterface + ".Driver" // readable s
Expand Down Expand Up @@ -100,6 +101,9 @@ type Device interface {
// GetPropertyUdi Operating-system specific transient device hardware identifier. This is an opaque string representing the underlying hardware for the device, and shouldn't be used to keep track of individual devices. For some device types (Bluetooth, Modems) it is an identifier used by the hardware service (ie bluez or ModemManager) to refer to that device, and client programs use it get additional information from those services which NM does not provide. The Udi is not guaranteed to be consistent across reboots or hotplugs of the hardware. If you're looking for a way to uniquely track each device in your application, use the object path. If you're looking for a way to track a specific piece of hardware across reboot or hotplug, use a MAC address or USB serial number.
GetPropertyUdi() (string, error)

// GetPropertyPath The path of the device as exposed by the udev property ID_PATH.
GetPropertyPath() (string, error)

// GetPropertyInterface The name of the device's control (and often data) interface. Note that non UTF-8 characters are backslash escaped, so the resulting name may be longer then 15 characters. Use g_strcompress() to revert the escaping.
GetPropertyInterface() (string, error)

Expand Down Expand Up @@ -214,6 +218,10 @@ func (d *device) GetPropertyUdi() (string, error) {
return d.getStringProperty(DevicePropertyUdi)
}

func (d *device) GetPropertyPath() (string, error) {
return d.getStringProperty(DevicePropertyPath)
}

func (d *device) GetPropertyInterface() (string, error) {
return d.getStringProperty(DevicePropertyInterface)
}
Expand Down