Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Send USB interrupt transfers from a WinUSB desktop app

RezaReza Member Posts: 12

I'm looking for a code to receive data from OSRfX2 in manner of interrupt transfer and continuously in 1ms intervals, Microsoft express this method with UWP, but I want to write in desktop App. Thank you in advance if share your experience.

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,986

    ??

    Let me translate that into USB: You want to receive data that's sent by the OSR USBFX2 device on the Interrupt IN Endpoint... and you expect that data to arrive in something like 1ms intervals.

    Is that correct?

    What do you plan to use as the driver (since you referenced "desktop App"? It's the DRIVER that reads from Endpoints.

    Or, use WinUsb... Call WinUSB_ReadPipe on the interrupt endpoint. I bet you could even send multiple of these reads asynchronously, using OVERLAPPED I/O.

    Peter Viscarola
    OSR
    @OSRDrivers

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,317

    Remember that the responsibilities are distributed here. It is up to the DESCRIPTOR to determine the packet size and the transfer interval. The driver doesn't have a say in that. The driver submits a buffer to be filled, and the host controller driver will submit read requests at the interval in the descriptors. You just have to make sure you submit enough requests that the queue never runs dry.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • RezaReza Member Posts: 12

    I apologize for asking my question badly.
    I give an example, in the standard interface of the serial port in visual studio, we actually have a COM that sits between the serial port driver and our application.
    In application we can put a (mySerialPort.DataReceived + = new SerialDataReceivedEventHandler (DataReceivedHandler);) call back event handler to fire as soon as it receives a character from our callback serial port and get the characters from the buffer. The question is, I do not know how that COM standard interface polls the serial driver? Does it create an endless loop to ReadRequest with the Windows API read method? And I really know that a ContinuoesRead mechanism is active in the driver and it consequently reads from the in endpoint and puts it in I/O Queue.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,317

    So, this is really a user-mode question? You're asking about the C#/.NET class Serial.Io.Ports?

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,986

    You're asking about the C#/.NET class Serial.Io.Ports?

    ...the source code for which is on GitHub? So, you can, you know... just look it up?

    Peter Viscarola
    OSR
    @OSRDrivers

  • RezaReza Member Posts: 12
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 12 September 2022 Live, Online
Internals & Software Drivers 23 October 2022 Live, Online
Kernel Debugging 14 November 2022 Live, Online
Developing Minifilters 5 December 2022 Live, Online