Class: RubDev::Device
- Inherits:
-
Object
- Object
- RubDev::Device
- Defined in:
- lib/rubdev/device.rb
Class Method Summary collapse
- .from_devnum(context, type, devnum) ⇒ Object
- .from_environment(context) ⇒ Object
- .from_subsystem_sysname(context, subsystem, sysname) ⇒ Object
- .from_syspath(context, syspath) ⇒ Object
Instance Method Summary collapse
- #action ⇒ Object
- #context ⇒ Object
- #devlinks ⇒ Object
- #devnode ⇒ Object
- #devnum ⇒ Object
- #devpath ⇒ Object
- #devtype ⇒ Object
- #driver ⇒ Object
- #initialized? ⇒ Boolean
- #parent ⇒ Object
- #parent_with_subsystem_devtype(subsystem, devtype) ⇒ Object
- #properties ⇒ Object
- #property(what) ⇒ Object (also: #[])
- #ref ⇒ Object
- #seqnum ⇒ Object
- #subsystem ⇒ Object
- #sysattr(what) ⇒ Object
- #sysattrs ⇒ Object
- #sysname ⇒ Object
- #sysnum ⇒ Object
- #syspath ⇒ Object
- #tag?(tag) ⇒ Boolean
- #tags ⇒ Object
- #unref ⇒ Object
- #usec ⇒ Object
Class Method Details
.from_devnum(context, type, devnum) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/rubdev/device.rb', line 54 def from_devnum (context, type, devnum) return nil unless context.is_a?(Context) and type.is_a?(String) and type.bytesize == 1 and devnum.is_a?(Integer) self.allocate.tap {|d| d.instance_variable_set(:@pointer, RubDev::C.udev_device_new_from_devnum(context.to_c, type, devnum)) } end |
.from_environment(context) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/rubdev/device.rb', line 71 def from_environment (context) return nil unless context.is_a?(Context) self.allocate.tap {|d| d.instance_variable_set(:@pointer, RubDev::C.udev_device_new_from_environment(context.to_c)) } end |
.from_subsystem_sysname(context, subsystem, sysname) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/rubdev/device.rb', line 63 def from_subsystem_sysname (context, subsystem, sysname) return nil unless context.is_a?(Context) and subsystem.is_a?(String) and sysname.is_a?(String) self.allocate.tap {|d| d.instance_variable_set(:@pointer, RubDev::C.udev_device_new_from_subsystem_sysname(context.to_c, subsystem, sysname)) } end |
.from_syspath(context, syspath) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/rubdev/device.rb', line 46 def from_syspath (context, syspath) return nil unless context.is_a?(Context) and syspath.is_a?(String) self.allocate.tap {|d| d.instance_variable_set(:@pointer, RubDev::C.udev_device_new_from_syspath(context.to_c, syspath)) } end |
Instance Method Details
#action ⇒ Object
151 152 153 |
# File 'lib/rubdev/device.rb', line 151 def action RubDev::C.udev_device_get_action(@pointer) end |
#context ⇒ Object
37 38 39 40 41 |
# File 'lib/rubdev/device.rb', line 37 def context Context.allocate.tap {|c| c.instance_variable_set(:@pointer, RubDev::C.udev_device_get_udev(@pointer)) } end |
#devlinks ⇒ Object
126 127 128 |
# File 'lib/rubdev/device.rb', line 126 def devlinks List.new(RubDev::C.udev_device_get_devlinks_list_entry(@pointer)) end |
#devnode ⇒ Object
116 117 118 |
# File 'lib/rubdev/device.rb', line 116 def devnode RubDev::C.udev_device_get_devnode(@pointer) end |
#devnum ⇒ Object
147 148 149 |
# File 'lib/rubdev/device.rb', line 147 def devnum RubDev::C.udev_device_get_devnum(@pointer) end |
#devpath ⇒ Object
92 93 94 |
# File 'lib/rubdev/device.rb', line 92 def devpath RubDev::C.udev_device_get_devpath(@pointer) end |
#devtype ⇒ Object
100 101 102 |
# File 'lib/rubdev/device.rb', line 100 def devtype RubDev::C.udev_device_get_devtype(@pointer) end |
#driver ⇒ Object
143 144 145 |
# File 'lib/rubdev/device.rb', line 143 def driver RubDev::C.udev_device_get_driver(@pointer) end |
#initialized? ⇒ Boolean
121 122 123 |
# File 'lib/rubdev/device.rb', line 121 def initialized? !RubDev::C.udev_device_get_is_initialized(@pointer).zero? end |
#parent ⇒ Object
80 81 82 83 84 |
# File 'lib/rubdev/device.rb', line 80 def parent Device.allocate.tap {|i| i.instance_variable_set(:@pointer, RubDev::C.udev_device_get_parent(@pointer)) } end |
#parent_with_subsystem_devtype(subsystem, devtype) ⇒ Object
86 87 88 89 90 |
# File 'lib/rubdev/device.rb', line 86 def parent_with_subsystem_devtype (subsystem, devtype) Device.allocate.tap {|i| i.instance_variable_set(:@pointer, RubDev::C.udev_device_get_parent_with_subsytem_devtype(@pointer, subsystem, devtype)) } end |
#properties ⇒ Object
130 131 132 |
# File 'lib/rubdev/device.rb', line 130 def properties List.new(RubDev::C.udev_device_get_properties_list_entry(@pointer)) end |
#property(what) ⇒ Object Also known as: []
138 139 140 |
# File 'lib/rubdev/device.rb', line 138 def property (what) RubDev::C.udev_device_get_property_value(@pointer, what.to_s) end |
#ref ⇒ Object
27 28 29 30 |
# File 'lib/rubdev/device.rb', line 27 def ref RubDev::C.udev_device_ref(@pointer) self end |
#seqnum ⇒ Object
165 166 167 |
# File 'lib/rubdev/device.rb', line 165 def seqnum RubDev::C.udev_device_get_seqnum(@pointer) end |
#subsystem ⇒ Object
96 97 98 |
# File 'lib/rubdev/device.rb', line 96 def subsystem RubDev::C.udev_device_get_subsystem(@pointer) end |
#sysattr(what) ⇒ Object
155 156 157 |
# File 'lib/rubdev/device.rb', line 155 def sysattr (what) RubDev::C.udev_device_get_sysattr_value(@pointer, what) end |
#sysattrs ⇒ Object
160 161 162 |
# File 'lib/rubdev/device.rb', line 160 def sysattrs List.new(RubDev::C.udev_device_get_sysattr_list_entry(@pointer)) end |
#sysname ⇒ Object
108 109 110 |
# File 'lib/rubdev/device.rb', line 108 def sysname RubDev::C.udev_device_get_sysname(@pointer) end |
#sysnum ⇒ Object
112 113 114 |
# File 'lib/rubdev/device.rb', line 112 def sysnum RubDev::C.udev_device_get_sysnum(@pointer) end |
#syspath ⇒ Object
104 105 106 |
# File 'lib/rubdev/device.rb', line 104 def syspath RubDev::C.udev_device_get_syspath(@pointer) end |
#tag?(tag) ⇒ Boolean
176 177 178 |
# File 'lib/rubdev/device.rb', line 176 def tag? (tag) !RubDev::C.udev_device_has_tag(tag).zero? end |
#tags ⇒ Object
134 135 136 |
# File 'lib/rubdev/device.rb', line 134 def List.new(RubDev::C.(@pointer)) end |