Recent Posts

Pages: [1] 2 3 ... 10
1
USB / Re: Trying to do something very simple - HID
« Last post by Jan Axelson on April 23, 2019, 08:35:04 am »
The first byte in the write buffer should be the report ID.

The buffer should be large enough to hold the report + 1 byte.
2
USB / Trying to do something very simple - HID
« Last post by DavidClarke on April 22, 2019, 08:28:44 pm »
I am new to all of this.  Trying to teach myself. I will try to show only the most relevant code.

I know I have everything up to here working right:

hReadFile = CreateFile(FILE_NAME_ASCIIZ, %GENERIC_READ OR %GENERIC_WRITE, %FILE_SHARE_READ OR %FILE_SHARE_WRITE, BYVAL %NULL, %OPEN_EXISTING, %FILE_FLAG_OVERLAPPED, %NULL)

Because this works:
MY_OVERLAPPED.Offset     = 0
MY_OVERLAPPED.OffsetHigh = 0
MY_OVERLAPPED.hEvent = GLOBAL_EVENT_WAIT_FOR_OVERLAPPED_READ
RESULT = WaitForSingleObject(MY_OVERLAPPED.hEvent, 3000)     
RESULT = ReadFile(BYVL hReadFile ,  READ_BUFFER, MY_InputReportByteLength, BYTES_READ, MY_OVERLAPPED)

HOWEVER...
This does not work:
WRITE_BUFFER = "TEST"
MY_OVERLAPPED.Offset     = 0
MY_OVERLAPPED.OffsetHigh = 0
RESULT = WriteFile(GLOBAL_FILE_HANDLE, WRITE_BUFFER, MY_OutputReportByteLength, BYTES_WRITTEN, MY_OVERLAPPED)   

I keep getting error 87 - ERROR_INVALID_PARAMETER
If I have the WRITE_BUFFER mal-formed will WriteFile refuse to do the function?  I am watching the data on wireshark and cant get any data to from the host to the device.

I have lots of other stuff working - I can get all the info about the device etc...  Just can't write to it. 




Input Data Items
  ================


  ** Input "Value" ** (HID Report Main Item):
  ------------------------------------------
  (Contents of a Windows _HIDP_VALUE_CAPS data structure)
    .UsagePage: 0x9  USAGEPAGE_BUTTON
    .ReportID: 1
    .BitSize: 8
    .ReportCount: 1
    .LogicalMin: 0
    .LogicalMax: 255
    .PhysicalMin: 0
    .PhysicalMax: 0
    .UnitsExp: 0x0
    .Units: 0x0
    .LinkCollection: 0
    .LinkUsagePage: 0xC  USAGEPAGE_CONSUMER_DEVICES
    .LinkUsage: 0x1  CONSUME_CONSUMER_CONTROL
    Main Item bits:
      Data,
      Variable,
      Absolute,
      No Wrap,
      Linear,
      Has Preferred State,
      NO Null State,
      Non Volatile (Output and Feature items only),
      Bit Field,
    .IsAlias: False
    .IsRange: True
    .IsStringRange: False
    .IsDesignatorRange: False
    .IsAbsolute: True
    .HasNull: False
    .Range.UsageMin: 0x1  BUTTON_1
    .Range.UsageMax: 0xF  BUTTON_15
    .Range.StringMin: 0x0
    .Range.StringMax: 0x0
    .Range.DesignatorMin: 0x0
    .Range.DesignatorMax: 0x0
    .Range.DataIndexMin: 0x0
    .Range.DataIndexMax: 0xE
  Additional Information:
    (Array element 0)
    .Name: "BUTTON_1"
    .ReportType = Input
    .ReportID: 1
    .HasBeenAdded: False
    .UsagePage: 0x9  USAGEPAGE_BUTTON
    .UsageMin: 0x1  BUTTON_1
    .UsageMax: 0xF  BUTTON_15
    .SizeInBits: 8
    .MaxListLength: 15
    .ScaleMode = smBoth (Read both Unscaled and Scaled values)
  Scaled and Unscaled Values:
    Unscaled : .pValueList[0]^ = 0x0 = 0
      Scaled : .pScaledValueList[0]^ = 0x0 = 0
               .WriteAsScaled[0]: False
    Unscaled : .pValueList[1]^ = 0x0 = 0
      Scaled : .pScaledValueList[1]^ = 0x0 = 0
               .WriteAsScaled[1]: False
    Unscaled : .pValueList[2]^ = 0x0 = 0
      Scaled : .pScaledValueList[2]^ = 0x0 = 0
               .WriteAsScaled[2]: False
    Unscaled : .pValueList[3]^ = 0x0 = 0
      Scaled : .pScaledValueList[3]^ = 0x0 = 0
               .WriteAsScaled[3]: False
    Unscaled : .pValueList[4]^ = 0x0 = 0
      Scaled : .pScaledValueList[4]^ = 0x0 = 0
               .WriteAsScaled[4]: False
    Unscaled : .pValueList[5]^ = 0x0 = 0
      Scaled : .pScaledValueList[5]^ = 0x0 = 0
               .WriteAsScaled[5]: False
    Unscaled : .pValueList[6]^ = 0x0 = 0
      Scaled : .pScaledValueList[6]^ = 0x0 = 0
               .WriteAsScaled[6]: False
    Unscaled : .pValueList[7]^ = 0x0 = 0
      Scaled : .pScaledValueList[7]^ = 0x0 = 0
               .WriteAsScaled[7]: False
    Unscaled : .pValueList[8]^ = 0x0 = 0
      Scaled : .pScaledValueList[8]^ = 0x0 = 0
               .WriteAsScaled[8]: False
    Unscaled : .pValueList[9]^ = 0x0 = 0
      Scaled : .pScaledValueList[9]^ = 0x0 = 0
               .WriteAsScaled[9]: False
    Unscaled : .pValueList[10]^ = 0x0 = 0
      Scaled : .pScaledValueList[10]^ = 0x0 = 0
               .WriteAsScaled[10]: False
    Unscaled : .pValueList[11]^ = 0x0 = 0
      Scaled : .pScaledValueList[11]^ = 0x0 = 0
               .WriteAsScaled[11]: False
    Unscaled : .pValueList[12]^ = 0x0 = 0
      Scaled : .pScaledValueList[12]^ = 0x0 = 0
               .WriteAsScaled[12]: False
    Unscaled : .pValueList[13]^ = 0x0 = 0
      Scaled : .pScaledValueList[13]^ = 0x0 = 0
               .WriteAsScaled[13]: False
    Unscaled : .pValueList[14]^ = 0x0 = 0
      Scaled : .pScaledValueList[14]^ = 0x0 = 0
               .WriteAsScaled[14]: False
  Description string IDs:
    StringMin: 0
    StringMax: 0
    StringID[0] = 0
    String[0] = ""


  ** Input "Value" ** (HID Report Main Item):
  ------------------------------------------
  (Contents of a Windows _HIDP_VALUE_CAPS data structure)
    .UsagePage: 0x9  USAGEPAGE_BUTTON
    .ReportID: 1
    .BitSize: 8
    .ReportCount: 1
    .LogicalMin: 0
    .LogicalMax: 255
    .PhysicalMin: 0
    .PhysicalMax: 0
    .UnitsExp: 0x0
    .Units: 0x0
    .LinkCollection: 0
    .LinkUsagePage: 0xC  USAGEPAGE_CONSUMER_DEVICES
    .LinkUsage: 0x1  CONSUME_CONSUMER_CONTROL
    Main Item bits:
      Data,
      Variable,
      Absolute,
      No Wrap,
      Linear,
      Has Preferred State,
      NO Null State,
      Non Volatile (Output and Feature items only),
      Bit Field,
    .IsAlias: False
    .IsRange: False
    .IsStringRange: False
    .IsDesignatorRange: False
    .IsAbsolute: True
    .HasNull: False
    .NotRange.Usage: 0x1  BUTTON_1
    .NotRange.StringIndex: 0x0
    .NotRange.DesignatorIndex: 0x0
    .NotRange.DataIndex: 0xF
  Additional Information:
    (Array element 1)
    .Name: "BUTTON_1"
    .ReportType = Input
    .ReportID: 1
    .HasBeenAdded: False
    .UsagePage: 0x9  USAGEPAGE_BUTTON
    .UsageMin: 0x1  BUTTON_1
    .UsageMax: 0x1  BUTTON_1
    .SizeInBits: 8
    .MaxListLength: 1
    .ScaleMode = smBoth (Read both Unscaled and Scaled values)
  Scaled and Unscaled Values:
    Unscaled : .pValueList[0]^ = 0x0 = 0
      Scaled : .pScaledValueList[0]^ = 0x0 = 0
               .WriteAsScaled[0]: False
  Description string IDs:
    StringMin: 0
    StringMax: 0
    StringID[0] = 0
    String[0] = ""


=================


  ** Output "Value" ** (HID Report Main Item):
  -------------------------------------------
  (Contents of a Windows _HIDP_VALUE_CAPS data structure)
    .UsagePage: 0x9  USAGEPAGE_BUTTON
    .ReportID: 2
    .BitSize: 8
    .ReportCount: 1023
    .LogicalMin: 0
    .LogicalMax: 255
    .PhysicalMin: 0
    .PhysicalMax: 0
    .UnitsExp: 0x0
    .Units: 0x0
    .LinkCollection: 0
    .LinkUsagePage: 0xC  USAGEPAGE_CONSUMER_DEVICES
    .LinkUsage: 0x1  CONSUME_CONSUMER_CONTROL
    Main Item bits:
      Data,
      Variable,
      Absolute,
      No Wrap,
      Linear,
      Has Preferred State,
      NO Null State,
      Non Volatile (Output and Feature items only),
      Bit Field,
    .IsAlias: False
    .IsRange: False
    .IsStringRange: False
    .IsDesignatorRange: False
    .IsAbsolute: True
    .HasNull: False
    .NotRange.Usage: 0xFF00  BUTTON_65280
    .NotRange.StringIndex: 0x0
    .NotRange.DesignatorIndex: 0x0
    .NotRange.DataIndex: 0x0
  Additional Information:
    (Array element 0)
    .Name: "BUTTON_65280"
    .ReportType = Output
    .ReportID: 2
    .HasBeenAdded: False
    .UsagePage: 0x9  USAGEPAGE_BUTTON
    .UsageMin: 0xFF00  BUTTON_65280
    .UsageMax: 0xFF00  BUTTON_65280
    .SizeInBits: 8
    .MaxListLength: 1
    .ScaleMode = smBoth (Read both Unscaled and Scaled values)
  Scaled and Unscaled Values:
    Unscaled : .pValueList[0]^ = 0x0 = 0
      Scaled : .pScaledValueList[0]^ = 0x0 = 0
               .WriteAsScaled[0]: False
  Array of Values:
    .MaxArrayLength: 1023
    .CurrentArrayLength: 1023
    .MaxArrayBytes: 1023
      Raw bytes :
    .pValArray[0]^ = 0x0 = 0
    .pValArray[1]^ = 0x0 = 0
    .pValArray[2]^ = 0x0 = 0
    .pValArray[3]^ = 0x0 = 0
    .pValArray[4]^ = 0x0 = 0
    .pValArray[5]^ = 0x0 = 0
    .pValArray[6]^ = 0x0 = 0  etc....



 .pValArray[1017]^ = 0x0 = 0
    .pValArray[1018]^ = 0x0 = 0
    .pValArray[1019]^ = 0x0 = 0
    .pValArray[1020]^ = 0x0 = 0
    .pValArray[1021]^ = 0x0 = 0
    .pValArray[1022]^ = 0x0 = 0
  Description string IDs:
    StringMin: 0
    StringMax: 0
    StringID[0] = 0
    String[0] = ""

====================================================
End of Report: Output Report ID 2
====================================================


   
3
I think the only way to find out is to try it.
4
USB / Do I have complete USB Host Codebase to extract bulk video from USB Device?
« Last post by jani12 on April 10, 2019, 03:30:37 pm »
I used open source Packet Capture(Pcap) and Wireshark to view video sent by USB Device.  The device sends 512 Bytes packet about every 200 us.  It's a composite device class.  It's a virtual port and bulk video.  Each monochrome raw frame is 640 x 480.

There is a GUI tool that run in windows that extracts video from this USB device and plays video on the PC.  The company who wrote this GUI tool gave us the source code.  I opened this source code into Visual Studio 2017 Professional version without creating a solution or project.  There are Sixteen projects in this codebase.

There are Two main folders.  They both seem to contain library code.  Their description is as follows:
First Folder -  includes information about bulk processing, command processing, port processing, script processing, and USB header information.
Second Folder name is Video - Library files that contain code on a frame viewer and how to stream video through USB, as well as capturing images off the device.

This code is in C Sharp.  Does this appear to be complete codebase for extracting video frames from USB device?  If yes, how to tell if this code will build and run without any changes?

5
USB / Re: AT-SAMD11 + GL850G HUB
« Last post by Jan Axelson on March 29, 2019, 10:55:10 am »
Yes, thanks bpaddock, it could just be a malfunctioning hub.
6
USB / Re: AT-SAMD11 + GL850G HUB
« Last post by bpaddock on March 29, 2019, 10:50:03 am »
   
   I got an arrangement with: one AT-SAMD11...

I would be careful of what upstream hubs you are using.

I'm making an assumption here that may be completely unfounded.

Years ago when Atmel came out with their first USB AVR I found that they worked with Intel hubs and did not work with NEC hubs (the PC motherboard had both).
I reported the problem back to Atmel in the hopes they would fix it.
I don't know if they ever did. 

My assumption is that the SAMD11 might somehow contain concepts from that same broken legacy hardware/code of long ago.

I've lost to much blood to the Bleeding Edge of technology... :-(

7
USB / Re: AT-SAMD11 + GL850G HUB
« Last post by Jan Axelson on March 28, 2019, 10:06:09 am »
Too many low-speed devices connected directly to the host?

Be sure the VID and PID combination for the keyboard doesn't match the values used by another device.

Looking at what happens before the resets (what is causing them?) might offer a clue.

 
8
USB / Re: Do I have USB 3.0 port?
« Last post by Jan Axelson on March 28, 2019, 10:00:42 am »
SS means support for SuperSpeed (5 Gbps, defined in USB 3.0, referred to as Gen 1 in the USB 3.1 spec).

SS+ means support for SuperSpeed Plus (10 Gbps, defined in USB 3.1, referred to as Gen 2 in the USB 3.1 spec).

Just announced: USB 3.2 Gen 2x2:  SuperSpeed USB 20 Gbps
9
USB / Re: Do I have USB 3.0 port?
« Last post by towlerg on March 28, 2019, 06:57:42 am »
The USB symbol followed by SS (super speed) does mean USB 3.0 and an additional plus sign means its a charging port.

An odd thing that I read recently, is that USB 3.0 and USB 3.1 Gen 1 are the same thing. Can you confirm that Jan?
10
USB / Do I have USB 3.0 port?
« Last post by jani12 on March 27, 2019, 03:30:58 pm »
I have about Ten USB ports on my Dell Desktop PC.  They are labeled SS and some symbol after that.
Does this mean SuperSpeed USB 3.0 port?
Pages: [1] 2 3 ... 10