Method: LIBUSB::Context#wrap_sys_device
- Defined in:
- lib/libusb/context.rb
#wrap_sys_device(dev_io) ⇒ Object
277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/libusb/context.rb', line 277 def wrap_sys_device(dev_io) dev_io = dev_io.is_a?(IO) ? dev_io.fileno : dev_io ppHandle = FFI::MemoryPointer.new :pointer res = Call.libusb_wrap_sys_device(@ctx, dev_io, ppHandle) LIBUSB.raise_error res, "in libusb_wrap_sys_device" if res!=0 handle = DevHandle.new self, ppHandle.read_pointer return handle unless block_given? begin yield handle ensure handle.close end end |