Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7856373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:41:10+00:00 2026-06-02T20:41:10+00:00

I am trying to send data over a USB to serial cable using the

  • 0

I am trying to send data over a USB to serial cable using the jUSB library. I’m coding in the NetBeans IDE on Windows.

What is the problem behind the message: “USB Host support is unavailable” in the following code:

package usb.core;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;    
import usb.core.*;

public class Main {
    public static void main(String[] args) throws IOException {
        try {
            // Bootstrap by getting the USB Host from the HostFactory.
            Host host = HostFactory.getHost();

            // Obtain a list of the USB buses available on the Host.
            Bus[] bus = host.getBusses();
            int total_bus = bus.length;
            System.out.println(total_bus);
            // Traverse through all the USB buses.
            for (int i = 0; i < total_bus; i++) {
                // Access the root hub on the USB bus and obtain the
                // number of USB ports available on the root hub.
                Device root = bus[i].getRootHub();
                int total_port = root.getNumPorts();

                // Traverse through all the USB ports available on the 
                // root hub. It should be mentioned that the numbering 
                // starts from 1, not 0.
                for (int j = 1; j <= total_port; j++) {
                    // Obtain the Device connected to the port.
                    Device device = root.getChild(j);
                    if (device != null) {
                        // USB device available, do something here.
                        // Obtain the current Configuration of the device
                        // and the number of interfaces available under the
                        // current Configuration.
                        Configuration config = device.getConfiguration();
                        int total_interface = config.getNumInterfaces();

                        // Traverse through the Interfaces
                        for (int k = 0; k < total_interface; k++) {
                            // Access the current Interface and obtain the 
                            // number of endpoints available on the Interface 
                            Interface itf = config.getInterface(k, 0);
                            int total_ep = itf.getNumEndpoints();

                            // Traverse through all the endpoints.
                            for (int l = 0; l < total_ep; l++) {
                                // Access the endpoint and
                                // obtain its I/O type
                                Endpoint ep = itf.getEndpoint(l);
                                String io_type = ep.getType();
                                boolean input = ep.isInput();

                                // If the endpoint is an input endpoint,
                                // obtain its InputStream and read in data.
                                if (input) {
                                    InputStream in;
                                    in = ep.getInputStream();
                                    // Read in data here
                                    in.close();
                                }
                                else {
                                    // If the Endpoint is an output Endpoint,
                                    // obtain its OutputStream and
                                    // write out data.
                                    OutputStream out;
                                    out = ep.getOutputStream();
                                    // Write out data here.
                                    out.close();
                                }
                            }
                        }
                    }
                }
            }

        }
        catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:41:12+00:00Added an answer on June 2, 2026 at 8:41 pm

    I Googled that error message and I found:

    • A forum post from 2005 that said that on Linux this can be due to something else having grabbed exclusive use of the USB controller: http://bytes.com/topic/java/answers/16736-jusb

    • An online copy of the source code, which indicates that this happens if getHost’s attempt to create a (platform specific) HostFactory fails. Unfortunately, the code eats unexpected exceptions (*), so it you’ll need to use a Java debugger to figure out what the real code is.

    (* The code catches Exception in maybeGetHost and other places and throws away the diagnostics! This is a major no-no, and a big red flag on overall code quality of the library. If I were you, I’d be looking for a better quality library to use.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to send some small data over UDP using the AsyncUdpSocket library .
I'm trying to send GPS data over http request. The problem is that the
I am trying to send and receive data over USB, my device, the Acer
I'm trying to AES encode data in java, send it over the network and
I am trying to send data to DotNetOpenAuth website as described here http://msdn.microsoft.com/en-us/library/debx8sh9.aspx Sender
i am trying to send multiple data using j query $.ajax method to my
I'm trying to send binary data from a database over an ASP.NET page. I
I am trying to send data over to a cakephp (mvc) website, via $.post().
I've been trying to figure out how to send and receive XML Data over
I'm trying to use SealedObjects to send data over an RMI connection target is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.