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 7045503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:32:18+00:00 2026-05-28T02:32:18+00:00

I’m trying to write a custom ‘driver’ for a keyboard (HID, if it matters),

  • 0

I’m trying to write a custom ‘driver’ for a keyboard (HID, if it matters), under Windows 7. The final goal is having two keyboards connected to the computer, but mapping all of the keys of one of them to special (custom) functions.

My idea is to use libusb-win32 as the 2nd keyboard’s driver, and write a small program to read data from the keyboard and act upon it. I’ve successfully installed the driver, and the device is recognized from my program, but all transfers timeout, even though I’m pressing keys.

here’s my code:

     struct usb_bus *busses;
     struct usb_device *dev;
     char buf[1024];

     usb_init();
     usb_find_busses();
     usb_find_devices();

     busses = usb_get_busses();
     dev = busses->devices;

     cout << dev->descriptor.idVendor << '\n' << dev->descriptor.idProduct << '\n';

     usb_dev_handle *h = usb_open(dev);
     cout << usb_set_configuration(h, 1) << '\n';
     cout << usb_claim_interface(h, 0) << '\n';
     cout << usb_interrupt_read(h, 129, buf, 1024, 5000) << '\n';
     cout << usb_strerror();
     cout << usb_release_interface(h, 0) << '\n';
     cout << usb_close(h) << '\n';

and it returns:

  1133
  49941
  0
  0
  -116
  libusb0-dll:err [_usb_reap_async] timeout error
  0
  0

(I’m pressing lots of keys in those 5 seconds)

There’s only one bus, one device, one configuration, one interface and one endpoint.
The endpoint has bmAttributes = 3 which implies I should use interrupt transfers (right?)

so why am I not getting anything? Am I misusing libusb? Do you know a way to do this without libusb?

  • 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-05-28T02:32:19+00:00Added an answer on May 28, 2026 at 2:32 am

    It’s pretty simple actually – when reading from the USB device, you must read exactly the right amount of bytes. You know what that amount is by reading wMaxPacketSize.

    Apparently a read request with any other size simply results in a timeout.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I'm having trouble keeping the paragraph square between the quote marks. In firefox the

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.