Skip to content
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

Detect physical mapping of sound cards #6

Closed
ewjmulder opened this issue Oct 5, 2017 · 1 comment
Closed

Detect physical mapping of sound cards #6

ewjmulder opened this issue Oct 5, 2017 · 1 comment

Comments

@ewjmulder
Copy link
Owner

ewjmulder commented Oct 5, 2017

First only for Linux, use the /dev/snd/by-path mapping

Consider using the extra USB information from LibUSB:

       Context context = new Context();
        int result = LibUsb.init(context);
        if (result != LibUsb.SUCCESS)
            throw new LibUsbException("Unable to initialize libusb.", result);
        // Read the USB device list
        DeviceList list = new DeviceList();
        int result2 = LibUsb.getDeviceList(null, list);
        if (result2 < 0)
            throw new LibUsbException("Unable to get device list", result);

        try {
            // Iterate over all devices and scan for the right one
            for (Device device : list) {
                DeviceDescriptor descriptor = new DeviceDescriptor();
                result = LibUsb.getDeviceDescriptor(device, descriptor);
                if (result != LibUsb.SUCCESS)
                    throw new LibUsbException("Unable to read device descriptor", result);

                System.out.println("Bus number: " + LibUsb.getBusNumber(device));
                System.out.println("Port number: " + LibUsb.getPortNumber(device));
                System.out.println(descriptor.dump());
                System.out.println("");
            }
        } finally {
            // Ensure the allocated device list is freed
            LibUsb.freeDeviceList(list, true);
        }
@ewjmulder ewjmulder added this to Selected for inclusion in alpha in Immerse alpha Apr 6, 2018
@ewjmulder
Copy link
Owner Author

For now it works fine without this extra info. Probably useful in a configuration module of some sort that can be split from the regular domain and audio-streaming. Closing this issue, follow-up can be created later. The code snipper is still available in the repo in src/test/java.

@ewjmulder ewjmulder moved this from Selected for inclusion in alpha to Done in Immerse alpha Apr 6, 2018
@ewjmulder ewjmulder modified the milestone: 0.5.0-ALPHA Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Immerse alpha
  
Done
Development

No branches or pull requests

1 participant