Method: LIBUSB::Device#port_numbers

Defined in:
lib/libusb/device.rb

#port_numbersArray<Fixnum> Also known as: port_path

Get the list of all port numbers from root for the specified device. Available since libusb-1.0.12.

Returns:

  • (Array<Fixnum>)

See Also:



128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/libusb/device.rb', line 128

def port_numbers
  # As per the USB 3.0 specs, the current maximum limit for the depth is 7.
  path_len = 7
  pPath = FFI::MemoryPointer.new :pointer, path_len

  l = if Call.respond_to?(:libusb_get_port_numbers)
    Call.libusb_get_port_numbers(@pDev, pPath, path_len)
  else
    Call.libusb_get_port_path(@context.instance_variable_get(:@ctx), @pDev, pPath, path_len)
  end
  pPath.read_array_of_uint8(l)
end