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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:15:19+00:00 2026-06-03T06:15:19+00:00

I am trying to write Java code to let my XOOM communicate with our

  • 0

I am trying to write Java code to let my XOOM communicate with our embedded device via USB to Serial cable.

I used this chunck of code:

connection.controlTransfer(0x21, 34, 0, 0, null, 0, 0);
connection.controlTransfer(0x21, 32, 0, 0, new byte[] { (byte) 0x80,
                                0x25, 0x00, 0x00, 0x00, 0x00, 0x08 }, 7, 0);

I know this is to send the setup request to the USB device. I do not understand why the requestType is 0x21, why requestID is 32, 34, etc.

According to the specs here: http://www.beyondlogic.org/usbnutshell/usb6.shtml#SetupPacket, in the standard device request, standard interface request and standard endpoint request, none of the requestType is 0x21 and none of the requestID is 32 or 34. Is there any explaination for these parameters including the transmitted datebuffer??

  • 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-03T06:15:20+00:00Added an answer on June 3, 2026 at 6:15 am

    The first byte (bmRequestType) in the setup packet is comprised of 3 fields. The first (least significant) 5 bits are the recipient, the next 2 bits are the type, and the last bit is the direction.

    If you have a value of 0x21, this has the binary representation of 100001. If you split it up into the individual fields, this is 0 01 00001, which corresponds to host-to-device, class, and interface, for the direction, type and recipient fields respectively.

    So this is a control message that is being sent to a particular interface, that is defined by some standard usb class.

    Since you mentioned that this was for communicating to a usb to serial adapter, I’m going to assume this is probably being sent to a communication interface, as per the USB Class Definitions for Communication Devices

    Per that document, a bRequest value of 34 (0x22) corresponds to a SET_CONTROL_LINE_STATE message, while 32 (0x20) corresponds to a SET_LINE_CODING message (pages 51 and 53), which seems to make sense as part of the setup/initialization of a serial device.

    The details for each of these messages is defined further down, on pages 57 and 58.

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

Sidebar

Related Questions

I'm trying to restructure some specific GUI code in a Java project, let's call
I'm trying to write Java code that executes some terminal commands. The code should
I am trying to write java code to return list of Nodes in a
I have the following C-code which I am trying to re-write in java. I
I am trying to write Java code as a part of my project to
I'm trying to write some Java code for a set of enum classes. Each
I'm trying to write a java code on an Android emulator that will send
I am trying to write a java code, for the conversion of an IGC
In trying to write more testable Java code, I have been using the Model-View-Presenter
I was trying to write a piece of Java code to read each line

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.