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

  • Home
  • SEARCH
  • 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 8875797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:04:13+00:00 2026-06-14T19:04:13+00:00

I need to send data via USB using Python, I’m using PyUSB (http://sourceforge.net/apps/trac/pyusb/) I

  • 0

I need to send data via USB using Python, I’m using PyUSB (http://sourceforge.net/apps/trac/pyusb/)
I look for any USB port available, and I tried to send a message:

devList = usb.core.find(find_all=True)
for dev in devList:
    for cfg in dev:
        for intf in cfg:
            sys.stdout.write('\t' + str(intf.bInterfaceNumber) + ',' + str(intf.bAlternateSetting) + '\n')
            for ep in intf:
                sys.stdout.write('\t\t' + str(ep.bEndpointAddress) + '\n')
                if ep.bEndpointAddress:
                    try:
                        dev.write(ep.bEndpointAddress, 'test', intf.bInterfaceNumber)
                    except Exception:
                        print "\t\terror : dev.write("+str(ep.bEndpointAddress)+", 'test', "+str(intf.bInterfaceNumber)+")"

The result is :

    0,0
            129
            error : dev.write(129, 'test', 0)
    0,1
            129
            error : dev.write(129, 'test', 0)
    0,0
            136
            error : dev.write(136, 'test', 0)
            10
            error : dev.write(10, 'test', 0)
    1,0
            139
            error : dev.write(139, 'test', 1)
            13
            error : dev.write(13, 'test', 1)

without try catch it gives:

usb.core.USBError: [Errno None] usb_claim_interface: could not claim interface 0, invalid configuration 0

What is wrong? Is there a best way to communicate via usb with python? because I just have found this lib

  • 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-14T19:04:15+00:00Added an answer on June 14, 2026 at 7:04 pm

    As stated in the tutorial:

    […] a device does not work without setting a configuration, even if it has just one! […]

    Apparently most of the times there is only one configuration. Assuming all those configurations are from different devices, you can do something like:

    for dev in devList:
        for cfg in dev:
    
            cfg.set()
    
            for intf in cfg:
    

    If you can’t set a configuration due to “resource busy”, you’ll need to unload its interface kernel driver:

    dev.detatch_kernel_driver(interface)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to send and receive data to/from a microcontroller using java using usb
I need to send data via http protocol (GET or POST request) from the
I need to send data to a hardware device over serial port. I'm using
I have a form, in which I need to send data selected via AJAX
I need to consume a JSON-formatted data stream via WebSocket, and send the data
I write application which will need send very confidential data to HTTP server. Because
I'm sending data to an extremely old system via TCP. I need to send
I need to send data via a url (it's JSON'd) that I would like
I have a problem while I need to send data using uploadify script. For
I need to send some data with radio button. This buttons are <td> <span

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.