-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get device path / port number #10
Comments
Additional info: ByteBuffer path = BufferUtils.allocateByteBuffer(8);
result = LibUsb.getPortNumbers(device, path);
if (result > 0)
{
for (int i = 0; i < result; i++)
{
System.out.print(path.get(i));
if (i + 1 < result) System.out.print("-");
}
System.out.println("");
} So when attaching a thumb drive between two different usb jacks it prints me for example 1-2 or 1-4. ...
port_numbers[i] = dev->port_number;
dev = dev->parent_dev;
... Then, I tried to mimick that behaviour with Usb4Java-Javax: UsbPort port = usbDevice.getParentUsbPort();
while (port != null)
{
System.out.print(port.getPortNumber());
port = port.getUsbHub().getParentUsbPort();
if (port != null) System.out.print("-");
} However, this does not work as expected since this allways gives me 1-2, independet of the port I attach the thumb drive to. Is this a bug or do I oversee something? |
perhaps it is easier to hack around package/protected name space and cast see: |
Yeah, this is what I ended up with. I added an Usb4JavaJavaxLibraryWrapper as part of the package org.usb4java.javax and wrote some casting functions like
|
Changing the visibility of classes or methods is not an option here because this would break the compatibility to the javax.usb spec. But I guess this could be fixed properly by using the port numbers reported by libusb instead of creating virtual port numbers. I'm open for pull requests here because of lack of time and fading javax-usb knowledge. |
Hi, using following code:
I can dump some basic info about the device connection. However, I need to know the physical location of the device. I can see it in dmesg:
Attaching the device to another port prints
So how do I retrieve the physical address
1-1.4
using usb4java-javax? The code above always prints the same port information, even when switching the ports.See also this thread on StackOverflow.
The text was updated successfully, but these errors were encountered: