Author Topic: Anyone know how to write a basic USB stack?  (Read 11369 times)

0 Members and 1 Guest are viewing this topic.

Offline donotdespisethesnake

  • Super Contributor
  • ***
  • Posts: 1093
  • Country: gb
  • Embedded stuff
Re: Anyone know how to write a basic USB stack?
« Reply #25 on: October 18, 2017, 04:41:30 pm »
If your time is really that worthless, please let me know and I'll send you some contract work I need done  ;D
Please let me know if you have any. Be aware that my time will be costly.

I am forced to write my own USB stack because of the sheer bloat of ST's libraries. 99% of the flash for just the boilerplate... You got to be kidding me.

That's really a surprise, because companies like ST make all their money giving away high-quality source code, and not from selling bigger chips. As you know, hiring people to write good software is incredibly cheap, because it's so easy anyone can do it.

 :palm:
Bob
"All you said is just a bunch of opinions."
 

Offline funkathustra

  • Regular Contributor
  • *
  • Posts: 150
  • Country: us
Re: Anyone know how to write a basic USB stack?
« Reply #26 on: October 18, 2017, 05:14:13 pm »
If your time is really that worthless, please let me know and I'll send you some contract work I need done  ;D
Please let me know if you have any. Be aware that my time will be costly.

I am forced to write my own USB stack because of the sheer bloat of ST's libraries. 99% of the flash for just the boilerplate... You got to be kidding me.
Who cares? Use the 32 KB chip like I mentioned, and then swap out to the 16 KB part for production?

Or, just... don't swap it out. The 32K part is seven cents more expensive in singles than the 16K part on DigiKey. Give me your address and I'll personally cut you a check for the price difference.

My own startup code takes about 500 bytes if bypassing newlib's _start. Calling _start (to properly initialize the C and C++ runtime) the code grew to 1.5k though.
Most ARM Cortex-M0 MCUs have a vector table that takes 1K alone. That's not even counting code.

If any serial port driver takes more than 1K it needs to be taken out the back and shot. Ditto startup code.

This isn't an 8051-type CISC-style processor, this is a 32-bit ARM microcontroller. A UART library that weighs in at 1K on an ARM chip is equivalent to 500 RISC instructions. You think you could write a software-buffered, interrupt-based UART library in less than 500 RISC instructions? Something that actually handles and reports all the error conditions? I'm not talking about a three-function Init()/Read()/Write() blocking driver.

Unless you're stuck on an island with the 16 KB chips, I really see no point to getting pedantic over this stuff.

But I get the feeling that I'm in the minority in this thread. Still, I wish someone could articulate specific reasons why anyone should care about spending time trimming down this stuff.

Different strokes, I guess....
« Last Edit: October 18, 2017, 05:17:16 pm by funkathustra »
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13695
  • Country: gb
    • Mike's Electric Stuff
Re: Anyone know how to write a basic USB stack?
« Reply #27 on: October 18, 2017, 06:24:32 pm »
I don't know if there is low-level driver for f0, but if it is, try checking that option in cubeMX, this should shrink things.

At the last place I worked, we were implementing a suite of STM32 drivers for an IoT reference design.  The client insisted that we build it on top of the ST LL drivers.  I could not see the point of this.  As far as I could tell, the LL "drivers" are nothing more than a thin obfuscation layer on top of the register interface.  Instead of writing a register directly, you call an LL function which...  writes a register.  Adding code layers is no benefit unless you are abstracting away some details, or encapsulating complexity somehow.  AFAICT the LL drivers do neither.

I haven't tried it out yet, but here's an independent USB driver which looks interesting:

Lightweight USB Device Stack
Apart from complex stuff like USB, TCP etc. it rarely makes any sense to use manufacturer libraries - things like serial are trivial to write for a specific application and pretty much impossible to write a general-purpose driver that suits everything  it's a waste of time trying.
A developer's time is much better spent learning how the hardware works than learning how a device library works, and it will be way easier to debug your own code that something that comes from elsewhere.
There seems to be a stupid attitude across many manufacturers that as they need to supply drivers for complex stuff, the also need to do it for simpler stuff as well, and it's generally a total waste of time for everyone. I'm in the process of extracting the useful parts from Microchip's USB Host driver from the car-crash of ridiculousness created by their Harmony framework - 10 levels of directories ( most contain only one object), multiple levels of abstraction for the simplest I/O port access - it's just ridiculous.
 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Anyone know how to write a basic USB stack?
« Reply #28 on: October 19, 2017, 06:06:09 am »
If your time is really that worthless, please let me know and I'll send you some contract work I need done  ;D
Please let me know if you have any. Be aware that my time will be costly.

I am forced to write my own USB stack because of the sheer bloat of ST's libraries. 99% of the flash for just the boilerplate... You got to be kidding me.
Who cares? Use the 32 KB chip like I mentioned, and then swap out to the 16 KB part for production?

Or, just... don't swap it out. The 32K part is seven cents more expensive in singles than the 16K part on DigiKey. Give me your address and I'll personally cut you a check for the price difference.
I'd like to, but sourcing them in China is another story.
My own startup code takes about 500 bytes if bypassing newlib's _start. Calling _start (to properly initialize the C and C++ runtime) the code grew to 1.5k though.
Most ARM Cortex-M0 MCUs have a vector table that takes 1K alone. That's not even counting code.
For Cortex-M0 the maximum possible vector table size is 192 bytes (16 core vectors and up to 32 NVIC vectors. You may want to take a good read at Cortex-M0 TRM.) The remaining 300 bytes is more than enough for setting up clocks and copying data sections.
If any serial port driver takes more than 1K it needs to be taken out the back and shot. Ditto startup code.

This isn't an 8051-type CISC-style processor, this is a 32-bit ARM microcontroller. A UART library that weighs in at 1K on an ARM chip is equivalent to 500 RISC instructions. You think you could write a software-buffered, interrupt-based UART library in less than 500 RISC instructions? Something that actually handles and reports all the error conditions? I'm not talking about a three-function Init()/Read()/Write() blocking driver.

Unless you're stuck on an island with the 16 KB chips, I really see no point to getting pedantic over this stuff.

But I get the feeling that I'm in the minority in this thread. Still, I wish someone could articulate specific reasons why anyone should care about spending time trimming down this stuff.

Different strokes, I guess....
At least for me my driver implemented almost non-blocking (block only when buffer is full) interrupt driven PIO within that limit, if optimized with -Os.
« Last Edit: October 19, 2017, 06:09:12 am by technix »
 

Offline lucazader

  • Regular Contributor
  • *
  • Posts: 221
  • Country: au
Re: Anyone know how to write a basic USB stack?
« Reply #29 on: October 19, 2017, 09:32:29 am »
Just throwing my 2c in here, feel free to ignore this..

I am currently developing a product with the F042K4/6 processor.

In regards to generated code size:
I have full USB-CDC and UART comms, custom serial protocol handling using the crc  and some leds and GPIOs.
As of this afternoon that all fits in less than 12k of flash, leaving a nice 4k buffer for other things. This is all based on an stm cube generated project using -Os and -flto.
One of the main things I have found in the stm cube that can help in reducing code size is to disable interupts that are not being used. Eg with the F042, if you dont need to wake up off uart1, or you dont need the interrupt handler for it, then disabling that save a few hundred kb.
Yes the generated code may appear large at first. However when I got stuck into the development I realised that adding extra features and implementing protocol decoding didnt actually increase the binary size significantly.

In regards to the chip pricing:
While the 32kb chip is only 7c more on digikey they are about 20-30c more (than the 16k variant) when sourced in china (currently). Which on a chip that only costs $1.2 ish is quite a large percentage.

On the argument of creating a USB stack:
I can see the cost-benefit of this if you are producing 10's of thousands of units. However with the current project i started coding on Tuesday (3 days of work so far). I am currently going through final functionality testing right now. I doubt developing, or even porting a usb stack of any sort would enable a quicker development cycle like this.
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2104
  • Country: au
Re: Anyone know how to write a basic USB stack?
« Reply #30 on: October 19, 2017, 10:30:42 am »
I'm not saying it's hard — just that it takes time, and seems redundant.

IMHO, it's the best way to learn how USB works.

I did that on the Parallax Propeller. It was a great way to learn about the low level details of USB. It also taught me a crap load about buggy host implementations and how to diagnose and work around them. The authors of the VIA stack back around the Windows 98 era needed taking out and shooting.
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: Anyone know how to write a basic USB stack?
« Reply #31 on: October 19, 2017, 04:58:14 pm »
As far as I could tell, the LL "drivers" are nothing more than a thin obfuscation layer on top of the register interface.  Instead of writing a register directly, you call an LL function which...  writes a register.  Adding code layers is no benefit unless you are abstracting away some details, or encapsulating complexity somehow.  AFAICT the LL drivers do neither.
I actually like using the LL "drivers". They are rather thin, but they do abstract away some of the STM32 minutiae that vary between families. Basically, what you get is a big collection of macros with a standard naming convention and InitStruct routines to configure the hardware. In contrast to the Cube's HAL, the LL stuff stays away from timing issues, buffering, callbacks, etc.
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Anyone know how to write a basic USB stack?
« Reply #32 on: October 19, 2017, 05:42:28 pm »
I ended up using this: https://github.com/dmitrystu/libusb_stm32

It enumerated. I kind of have to use HID, but Linux grabbing the device isn't that much of a hassle after all thanks to libhidapi, which is cross platform like libusb, and does not have problems with Linux kernel grabbing the device.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13695
  • Country: gb
    • Mike's Electric Stuff
Re: Anyone know how to write a basic USB stack?
« Reply #33 on: October 19, 2017, 05:57:30 pm »
From what I've seen in various places, once you have a working stack that's often only half the battle.
The rest is knowing all the quirks of incorrectly implemented features on the things you want it to connect to.
There are some comments that refer to this in the Keysight interview, where he remarks that Microsoft have the best knowledge of USB and networking from all the zillions of PCs out there.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Anyone know how to write a basic USB stack?
« Reply #34 on: October 19, 2017, 06:14:52 pm »
From what I've seen in various places, once you have a working stack that's often only half the battle.
The rest is knowing all the quirks of incorrectly implemented features on the things you want it to connect to.
This may be true as a host, but as a device, I don't see an issue. There are differences between the OSes when it comes to marginal stuff, but if you follow the spec on your end, things will just work. At least in my experience.

It is interesting that is pretty easy to crash both Windows and Linux though a bad behaving device, which happens sometimes during stack development.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Anyone know how to write a basic USB stack?
« Reply #35 on: October 19, 2017, 09:30:40 pm »
I took a third party stack actually, and thankfully it is entirely interrupt driven so I just initialized it in a constructor and set up the USB interrupt for it. No direct reference in main. Yay? And it took me a little over 5k Flash. Speaking of bloat in Cube.

Now I need to get the USB HID Vendor Class Device up... Do you know how to get Windows enumerate it properly? It enumerates for now, but it says "requested operation failed."
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Anyone know how to write a basic USB stack?
« Reply #36 on: October 19, 2017, 09:33:01 pm »
Now I need to get the USB HID Vendor Class Device up... Do you know how to get Windows enumerate it properly? It enumerates for now, but it says "requested operation failed."
Show your descriptors. It usually just works out of the box.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Anyone know how to write a basic USB stack?
« Reply #37 on: October 19, 2017, 09:37:51 pm »
Now I need to get the USB HID Vendor Class Device up... Do you know how to get Windows enumerate it properly? It enumerates for now, but it says "requested operation failed."
Show your descriptors. It usually just works out of the box.

Code: [Select]
static const struct usb_device_descriptor device_descriptor =
{
    .bLength            = sizeof(struct usb_device_descriptor),
    .bDescriptorType    = USB_DTYPE_DEVICE,
    .bcdUSB             = VERSION_BCD(2,0,0),
    .bDeviceClass       = USB_CLASS_PER_INTERFACE,
    .bDeviceSubClass    = USB_SUBCLASS_NONE,
    .bDeviceProtocol    = USB_PROTO_NONE,
    .bMaxPacketSize0    = USB_EP0_SIZE,
    .idVendor           = USB_VID,
    .idProduct          = USB_PID,
    .bcdDevice          = VERSION_BCD(0,1,0),
    .iManufacturer      = 1,
    .iProduct           = 2,
    .iSerialNumber      = INTSERIALNO_DESCRIPTOR,
    .bNumConfigurations = 1
};

static const struct config_descriptor config_descriptor =
{
.config =
{
        .bLength                = sizeof(struct usb_config_descriptor),
        .bDescriptorType        = USB_DTYPE_CONFIGURATION,
        .wTotalLength           = sizeof(config_descriptor),
        .bNumInterfaces         = 1,
        .bConfigurationValue    = 1,
        .iConfiguration         = NO_DESCRIPTOR,
        .bmAttributes           = USB_CFG_ATTR_RESERVED,
        .bMaxPower              = USB_CFG_POWER_MA(300)
},
.interface =
{
        .bLength                = sizeof(struct usb_interface_descriptor),
        .bDescriptorType        = USB_DTYPE_INTERFACE,
        .bInterfaceNumber       = 0,
        .bAlternateSetting      = 0,
        .bNumEndpoints          = 2,
        .bInterfaceClass        = USB_CLASS_HID,
        .bInterfaceSubClass     = USB_SUBCLASS_NONE,
        .bInterfaceProtocol     = USB_PROTO_NONE,
        .iInterface             = NO_DESCRIPTOR,
},
.endpoints =
{
{
        .bLength                = sizeof(struct usb_endpoint_descriptor),
        .bDescriptorType        = USB_DTYPE_ENDPOINT,
        .bEndpointAddress       = USB_RXD_EP,
        .bmAttributes           = USB_EPTYPE_INTERRUPT,
        .wMaxPacketSize         = USB_PKT_SZ,
        .bInterval              = 100,
},
{
        .bLength                = sizeof(struct usb_endpoint_descriptor),
        .bDescriptorType        = USB_DTYPE_ENDPOINT,
        .bEndpointAddress       = USB_TXD_EP,
        .bmAttributes           = USB_EPTYPE_INTERRUPT,
        .wMaxPacketSize         = USB_PKT_SZ,
        .bInterval              = 100,
}
}
};

static const uint8_t usb_hid_report[] =
{
    0x06, 0x00, 0xff,              // USAGE_PAGE (Vendor Defined Page 1)
    0x09, 0x01,                    // USAGE (Vendor Usage 1)
    0xa1, 0x01,                    // COLLECTION (Application)
    0x85, 0x01,                    //   REPORT_ID (1)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x27, 0xff, 0xff, 0x00, 0x00,  //   LOGICAL_MAXIMUM (65535)
    0x75, 0x10,                    //   REPORT_SIZE (16)
    0x95, 0x01,                    //   REPORT_COUNT (1)
    0x81, 0x82,                    //   INPUT (Data,Var,Abs,Vol)
    0x85, 0x02,                    //   REPORT_ID (2)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x27, 0xff, 0xff, 0x00, 0x00,  //   LOGICAL_MAXIMUM (65535)
    0x75, 0x10,                    //   REPORT_SIZE (16)
    0x95, 0x01,                    //   REPORT_COUNT (1)
    0x91, 0x82,                    //   OUTPUT (Data,Var,Abs,Vol)
    0xc0                           // END_COLLECTION
};

static const struct usb_hid_descriptor hid_descriptor =
{
.bLength                = sizeof(struct usb_hid_descriptor),
.bDescriptorType        = USB_DTYPE_HID,
.bcdHID                 = VERSION_BCD(1,1,1),
.bCountryCode           = USB_HID_COUNTRY_US,
.bNumDescriptors        = 1,
.bDescriptorType0       = USB_DTYPE_HID_REPORT,
.wDescriptorLength0     = sizeof(usb_hid_report)
};

Should I make the TX and RX buffers larger? Currently they are 2-byte buffers matching the uint16_t from the PWM side of things.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Anyone know how to write a basic USB stack?
« Reply #38 on: October 19, 2017, 09:45:06 pm »
Your report descriptor looks unusual. It may work, but typically what you see for HID used as a general purpose data transfer thing you want to specify reports to be exact size of the endpoint.

Copy the descriptor from here https://github.com/ataradov/bootloaders/blob/master/firmware/usb_hid_samd11/usb_descriptors.c , it is known to work without problems on all OSes.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Anyone know how to write a basic USB stack?
« Reply #39 on: October 19, 2017, 09:52:25 pm »
Your report descriptor looks unusual. It may work, but typically what you see for HID used as a general purpose data transfer thing you want to specify reports to be exact size of the endpoint.

Copy the descriptor from here https://github.com/ataradov/bootloaders/blob/master/firmware/usb_hid_samd11/usb_descriptors.c , it is known to work without problems on all OSes.
I am using 2-byte transfers... Maybe I have other implementation problems...
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3781
  • Country: de
Re: Anyone know how to write a basic USB stack?
« Reply #40 on: October 19, 2017, 10:22:42 pm »
If your time is really that worthless, please let me know and I'll send you some contract work I need done  ;D
Please let me know if you have any. Be aware that my time will be costly.

I am forced to write my own USB stack because of the sheer bloat of ST's libraries. 99% of the flash for just the boilerplate... You got to be kidding me.

If you can deal with the license (or are willing to purchase a commercial one), then libopencm3 and ChibiOS contain both very good USB stacks for various ST chips, with lots of examples. Getting a HID device or serial port over USB running with these takes no time at all.

Both also contain decent HAL, so you can skip the entire Cube mess.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3137
  • Country: ca
Re: Anyone know how to write a basic USB stack?
« Reply #41 on: October 19, 2017, 10:32:32 pm »
Now I need to get the USB HID Vendor Class Device up... Do you know how to get Windows enumerate it properly? It enumerates for now, but it says "requested operation failed."

What do you mean "It enumerates for now". Do you see the HID device in the device manager?

Who says "requested operation failed"?
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Anyone know how to write a basic USB stack?
« Reply #42 on: October 20, 2017, 04:56:34 am »
Now I need to get the USB HID Vendor Class Device up... Do you know how to get Windows enumerate it properly? It enumerates for now, but it says "requested operation failed."

What do you mean "It enumerates for now". Do you see the HID device in the device manager?

Who says "requested operation failed"?
It says HID, but there is a yellow exclamation mark on it, and Windows is the one claiming "requested operation failed."
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Anyone know how to write a basic USB stack?
« Reply #43 on: October 20, 2017, 04:32:08 pm »
Well I have managed to get it to enumerate under macOS and Windows. Now Linux is spitting out EPIPE like this:

Code: [Select]
[71430.459031] usb 3-3.1: new full-speed USB device number 21 using xhci_hcd
[71430.568139] usb 3-3.1: New USB device found, idVendor=0002, idProduct=c001
[71430.568141] usb 3-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=254
[71430.568142] usb 3-3.1: Product: USB Light Switch
[71430.568143] usb 3-3.1: Manufacturer: SushiBits by Max Chan <xcvista@me.com>
[71430.568143] usb 3-3.1: SerialNumber: CD40BBB5
[71430.582643] usbhid 3-3.1:1.0: can't add hid device: -32
[71430.582653] usbhid: probe of 3-3.1:1.0 failed with error -32
[71434.831073] usb 3-3.1: USB disconnect, device number 21
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Anyone know how to write a basic USB stack?
« Reply #44 on: October 20, 2017, 04:34:10 pm »
Try my HID report descriptor. I don't know what different OSes actually do with them, but I see no other reason for this behavior.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Anyone know how to write a basic USB stack?
« Reply #45 on: October 20, 2017, 04:42:46 pm »
Try my HID report descriptor. I don't know what different OSes actually do with them, but I see no other reason for this behavior.
It is not working under Linux. I think my heavily reduced descriptor is perfectly fine:

Code: [Select]
static const uint8_t usb_hid_report[] =
{
    0x06, 0x00, 0xff,              // USAGE_PAGE (Vendor Defined Page 1)
    0x09, 0x01,                    // USAGE (Vendor Usage 1)
    0xa1, 0x01,                    // COLLECTION (Application)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x27, 0xff, 0xff, 0x00, 0x00,  //   LOGICAL_MAXIMUM (65535)
    0x75, 0x10,                    //   REPORT_SIZE (16)
    0x95, 0x01,                    //   REPORT_COUNT (1)
    0x09, 0x01,                    //   USAGE (Vendor Usage 1)
    0x81, 0x82,                    //   INPUT (Data,Var,Abs,Vol)
    0x09, 0x01,                    //   USAGE (Vendor Usage 1)
    0x91, 0x82,                    //   OUTPUT (Data,Var,Abs,Vol)
    0xc0                           // END_COLLECTION
};
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3137
  • Country: ca
Re: Anyone know how to write a basic USB stack?
« Reply #46 on: October 20, 2017, 04:52:42 pm »
Well I have managed to get it to enumerate under macOS and Windows. Now Linux is spitting out EPIPE like this:

Code: [Select]
[71430.459031] usb 3-3.1: new full-speed USB device number 21 using xhci_hcd
[71430.568139] usb 3-3.1: New USB device found, idVendor=0002, idProduct=c001
[71430.568141] usb 3-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=254
[71430.568142] usb 3-3.1: Product: USB Light Switch
[71430.568143] usb 3-3.1: Manufacturer: SushiBits by Max Chan <xcvista@me.com>
[71430.568143] usb 3-3.1: SerialNumber: CD40BBB5
[71430.582643] usbhid 3-3.1:1.0: can't add hid device: -32
[71430.582653] usbhid: probe of 3-3.1:1.0 failed with error -32
[71434.831073] usb 3-3.1: USB disconnect, device number 21

I would guess something is wrong with the HID descriptor. It gets the device, but cannot decode report descriptiors or doesn't receive the report descriptors at all.

Your descriptor is similar to my descriptors which are working except that the sizes/counts are different. Except that mine don't have report ids (which you don't need anyway since you only have one report of every kind) and specify usage for every report.

It is very easy with Linux. You just look at the source code and figure out in what case it returns the above error -32. You can even re-compile it and output your own log messages to see what's wrong.


 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Anyone know how to write a basic USB stack?
« Reply #47 on: October 20, 2017, 04:54:33 pm »
My descriptor absolutely works on all platforms. It was created a long time ago and travels from project to project.

There must be something  wrong with the way you send it.
Alex
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3137
  • Country: ca
Re: Anyone know how to write a basic USB stack?
« Reply #48 on: October 20, 2017, 05:43:02 pm »
My descriptor absolutely works on all platforms. It was created a long time ago and travels from project to project.

Yes, mine too. It is practically identical to the last one technix has posted except for sizes, counts and presence of the feature report.
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Anyone know how to write a basic USB stack?
« Reply #49 on: October 20, 2017, 06:02:51 pm »
My descriptor absolutely works on all platforms. It was created a long time ago and travels from project to project.

There must be something  wrong with the way you send it.
I get the same error with your descriptors. Maybe Linux need some other method to feed the report descriptor?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf