Fog Creek Software
Discussion Board

Writing a driver for an USB-to-Serial adapter

For my diploma thesis I have to write an USB-to-Serial Adapter driver. I must start from the source code of the serial port driver and the documentation given by the DDK from MS.

I have some general questions:

I am interested where could I found a more detailed documentation about the serial port, other that the  DDK one, or/and  could I found somewhere the source code of an USB-to-Serial Adapter driver ? It will be nice if you can give me the web address for this!

It will help me a lot if somebody, who can say is a specialist or has  a lot of experience in USB field, can give me some advices for writing this USB-to-Serial Adapter driver. Or perhaps he can give some literature which can help me to go further.

And I have some special questions:

What does the value which is written in the field Parameters.Others.Argument4 from the structure StackLocation of an IRP? More exactly what does the references saved there?

Can I use in the source code of an USB-to-Serial Adapter driver a Read-Queue and a Write-Queue , which in the serial port driver is used on simultaneous reading and writing data from the port?

The serial port use an Interrupt. So the Serial port driver has an ISR routine. All the external devices linked to an USB port does not use an Interrupt. How can I use the ISR routine of the  serial port driver in the USB-to-Serial Adapter driver? Is this possible?

What does the recursive calling of the routines SerialPutChar and SerialHandleModemUpdate ?

Thanks in advance.

Oliver Stanley
Tuesday, July 08, 2003

What University? Can we forward this letter to your advisor? If not, then perhaps you should reconsider asking a group of strangers to write your thesis for you...

[some of the questions are legit, but some seem seriously in the realm of "please do my work for me"]


Tuesday, July 08, 2003

Aren't you supposed to do fundamental research for your thesis? Writing a device driver is a strange assignment, to say the least, if this is for a university.

Frederik Slijkerman
Tuesday, July 08, 2003

Let me get this straight.

For your thesis you have to write this driver for USB to serial, given a serial driver as a starting point.

And so you want someone to give you the source code for a USB to serial driver.

And, so I have to ask -- if all you are going to do for a thesis project is look up some code on the net, [er well - you aren't even going to the trouble of googling, you're asking other people to google for you (what, you don't know how to google?)] do you think that you are really deserving of whatever degree your thesis will confer?

Last time I checked the whole idea behind a thesis was that it was original, novel work that substantially contributed to its field.

Tuesday, July 08, 2003

I should also mention that the first serial driver I wrote was written by me in assembly when I was 14 years old. The second serial driver I wrote was a single project in a sophomore level computer science class on embedded systems. It was a 1 week project.

Whatever school you are going to where this would be considered thesis level work must be pretty damn lame. Don't tell me, you're getting a PhD at a top rated university in India, right?

Tuesday, July 08, 2003

Looking at the ddk\src\comm\serial source code, especially the comments in serialp.h, the Other4 field is not used by the O/S and is treated by the serial driver as a place where it can store private data in each IRP. The private data that it's storing there, those bit flags, appear to be the various reasons why it's currently not be safe to complete this IRP immediately: for example, it's not safe to complete the IRP while the IRP is being used by the ISR.

You can get more detailed information about serial port hardware by goggling for "UART" for example ... the DDK support the "16550" style of UART.

I can't answer your USB questions.

I don't know what a "USB-to-serial" driver is: do you mean a device driver which allows applications which know about serial ports to talk to USB devices? If so, then:

* Look at the architecture of the "parclass" driver, which shows how to put one device driver on top of another, using APIs like IoGetDeviceObjectPointer(), IoGet*IrpStackLocation(), and IoCallDriver()

* You need to write a driver which looks like a serial driver (i.e. which supports all the IRPs that the standard serial driver supports), except that instead of using a Serial ISR to do the I/O it uses (passes IRPs down to) the underlying hardware USB driver for the work.

I'd understand your looking for source code beyond the DDK, if you were doing this for any reason other than your thesis.

In case you're interested, it took me 8 weeks to finish my first NT device driver (starting with the DDK serial driver source code and documentation, and knowledge of UARTs).

Christopher Wells
Tuesday, July 08, 2003


that comment about India was entirely uncalled for...!
are u totally ignorant ??
I doubt you are at the level where most
of the graduates of the top rated unviersity (IIT)
from India are, so please don't advertise your stupidity here !!

Double Graduate
Tuesday, July 08, 2003

"are u totally ignorant ??"

At least he can spell 'you'!

Tuesday, July 08, 2003

The original poster did refer to his "diploma thesis"; although an assignment for a diploma-level course would not normally be referred to as a "thesis".

Tuesday, July 08, 2003

I'm assuming by "diploma thesis", he means what is commonly referred to as a senior thesis.  If you aren't familiar with what a senior thesis is, do a google search and you'll get a billion links.

Tuesday, July 08, 2003

This Oliver Stanley from Massachusetts?

Tuesday, July 08, 2003


Nice try - that list is last name - first name so

that is Stanley Oliver not Oliver Stanley...

Wednesday, July 09, 2003

Graduate obviously has the diseease most geniuses suffer from - he thinks everyone else is an idiot.

Oooh you wrote a driver when you where 14? Please post your address, I'd like to send you a batch of my finest chocolate chip cookies. Fucking ego maniac. Sad really. Someone asks for help and you brow beat him. Lemme guess, you graduated from an Ivy League school in America...

Wednesday, July 09, 2003

BTW he said "diploma". When you graduated college did you get a diploma? Open Mouth. Insert foot.

Wednesday, July 09, 2003


Yes, when I graduated from the university, they handed me a diploma. That's a document they give you that indicates you have earned a degree are are entitled to the rights and privledges the degree conveys. Sometimes the diploma is called a sheepskin since the used to be written on sheepskin parchments.

Often a thesis, or dissertation, is a requirement for earning a diploma. The thesis is an original work that contributes to the field the prospective diplomate is seeking to become qualified in. A thesis requires research. Academic research is different from business research. Business research can mean infiltrating the competitor and stealing his secrets. It can involve finding and buying or licensing the IP assets of others. It can involve copying published solutions from others. In academia, any such research into the work of others needs to be credited in the acknowledgements and references section at the end of the thesis. Going no newsgroups looking for a premade solution is no different than writing a research paper by photocopying a paper someone else has written and changing the name. It's academically dishonest and what is meant by plagarism. Plagarising the work of others is smart business sense since it means quicker time to market and money saved on R&D. But in academia, plagarism is a serious breech of ethics. A candidate who plagarizes his thesis would be disqualified from receiving a diploma and expelled from any reputable university.

I'm no genius -- there's plenty of programmers better than I. I didn't go to any ivy league university either. Writing device drivers is par for the course at any reputable engineering school. And writing device drivers at age 14 is no big deal in engineering - it's a common thing to find out about an able designer.

Wednesday, July 09, 2003

Graduate, what I was trying to convey was this: I think the guy is in high school. I judged you wrong and I take back my nasty comments. Not unhread of. I like crowpie and eat it daily.

Wednesday, July 09, 2003

*  Recent Topics

*  Fog Creek Home