NDIS Miniport driver for USB Com Port

hi all,

I would like to create an ndis miniport driver that does not run a network interface card, but a USB to com port instead .

the usb device generate 2 com ports , can the ndis driver communicate with these 2 com port ?

[TCP/IP] [Service]
| |
[NDIS Miniport Driver]
| |
| |
[Com 1] [Com 2]
| |
[Dail up] [get network status]

I had completed the USB to com port driver and create a device interface by
WdfDeviceCreateDeviceInterface with GUID .

I am trying to do by the step of
1.IoGetDeviceInterfaces(GUID , & devicelist )
question: how can i distinguish the Com 1 and Com 2? It seems there is only a list ?
2.IoGetDeviceObjectPointer(&pDevObj) to get device object
3.Iocalldriver(pDevObj , Irp) to send IRP to com port driver .

I don’t know if it is feasible ,i hope somebody can help .

I found if i plug in two devices that will make it more complex . so i try to make each com port more exclusive to be recognize .maybe PID VID or any other . any clues will be great appreciated .

Will com2 always be a network connection ?

d

dent from a phine with no keynoard

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Sunday, March 06, 2011 2:38 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] NDIS Miniport driver for USB Com Port

hi all,

I would like to create an ndis miniport driver that does not run a network interface card, but a USB to com port instead .

the usb device generate 2 com ports , can the ndis driver communicate with these 2 com port ?

[TCP/IP] [Service]
| |
[NDIS Miniport Driver]
| |
| |
[Com 1] [Com 2]
| |
[Dail up] [get network status]

I had completed the USB to com port driver and create a device interface by
WdfDeviceCreateDeviceInterface with GUID .

I am trying to do by the step of
1.IoGetDeviceInterfaces(GUID , & devicelist )
question: how can i distinguish the Com 1 and Com 2? It seems there is only a list ?
2.IoGetDeviceObjectPointer(&pDevObj) to get device object
3.Iocalldriver(pDevObj , Irp) to send IRP to com port driver .

I don’t know if it is feasible ,i hope somebody can help .

I found if i plug in two devices that will make it more complex . so i try to make each com port more exclusive to be recognize .maybe PID VID or any other . any clues will be great appreciated .


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

>>Will com2 always be a network connection ?
Yes ,the only purpose of the device. the ndis driver get OIDs and transfer to AT command then send these commands to com port .the both com port are for the networking .

Why expose them as a COM at all then? At least in the sense of the COM port device interface. You shoud just do this

[tcp] [whatever]
| |
[your ndis miniport] [your ndis miniport]
| |
[dial up pdo] [pdo #2]
[Your usb device driver (bus driver)]

Your miniport loads on these PDOs by matching on your own custom hardware ID, no need to find anything. No problems when you have 2 devices plugged in.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Sunday, March 06, 2011 8:22 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] NDIS Miniport driver for USB Com Port

>Will com2 always be a network connection ?
Yes ,the only purpose of the device. the ndis driver get OIDs and transfer to AT command then send these commands to com port .the both com port are for the networking .


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

>Why expose them as a COM at all then? At least in the sense of the COM port

device interface. You shoud just do this

[tcp] [whatever]
| |
[your ndis miniport] [your ndis miniport]
| |
[dial up pdo] [pdo #2]
[Your usb device driver (bus driver)]

Your miniport loads on these PDOs by matching on your own custom hardware ID, no
need to find anything. No problems when you have 2 devices plugged in.

would it appear 2 NDIS driver in network connection ? this is a temporary solution . we had completed release the hardware to the customer and the device generate 2 com ports .

the vendor would like to connect to network by NIC way (at least it seems to ) instead of Modem way . so i try to create a NDIS driver ,and communicate with com port to complete all the NDIS operation . for NIDS tcp/Ip transmission occupies the dial up pdo (Com x) , we had to get Network status or signal strength from pdo #2 (Com x+1) . i would like to just create 1 NDIS instance in network connection.

If you want just one NDIS instance, no need for a bus driver at all

[tcp]
|
[your ndis miniport which is a KMDF+NDIS driver]
|
[USB PDO]

Your ndis miniport understand how to talk to both COM ports that reside in the hw. You don’t need to split them up at all if they are consumed by the same miniport.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Sunday, March 06, 2011 5:46 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] NDIS Miniport driver for USB Com Port

Why expose them as a COM at all then? At least in the sense of the COM
port device interface. You shoud just do this

[tcp] [whatever]
| |
[your ndis miniport] [your ndis miniport]
| |
[dial up pdo] [pdo #2]
[Your usb device driver (bus driver)]

Your miniport loads on these PDOs by matching on your own custom
hardware ID, no need to find anything. No problems when you have 2 devices plugged in.

would it appear 2 NDIS driver in network connection ? this is a temporary solution . we had completed release the hardware to the customer and the device generate 2 com ports .

the vendor would like to connect to network by NIC way (at least it seems to ) instead of Modem way . so i try to create a NDIS driver ,and communicate with com port to complete all the NDIS operation . for NIDS tcp/Ip transmission occupies the dial up pdo (Com x) , we had to get Network status or signal strength from pdo #2 (Com x+1) . i would like to just create 1 NDIS instance in network connection.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

>Your ndis miniport understand how to talk to both COM ports that reside in the

hw. You don’t need to split them up at all if they are consumed by the same
miniport.

How it understand to talk to Both COM ports while I am writing the NDIS Driver ? do you means that there is a common handle or else in NDIS ,and i set the handle to send Irp package ? dispatch the package just rely on this handle ? It seems weird. I thought that i should get the both com port device interface to send IRP, should i ?

sorry for i am not proficient in this driver. if there is a way for me to bind the ndis driver to specify com port ?

I think you are confusing 2 things, the NDIS top edge interface (ie IRPS) and how to talk to your device (the bus interface). a pci based nic uses hw registers and dma to talk the device. In usb, the driver uses IRPs. In this case, the irps you use to talk to your device are irps you create, not irps you receive from above. Look at the usbnwifi example on how to talk to a usb device in an ndis miniport

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Sunday, March 06, 2011 11:05 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] NDIS Miniport driver for USB Com Port

Your ndis miniport understand how to talk to both COM ports that reside
in the hw. You don’t need to split them up at all if they are consumed
by the same miniport.

How it understand to talk to Both COM ports while I am writing the NDIS Driver ? do you means that there is a common handle or else in NDIS ,and i set the handle to send Irp package ? dispatch the package just rely on this handle ? It seems weird. I thought that i should get the both com port device interface to send IRP, should i ?

sorry for i am not proficient in this driver. if there is a way for me to bind the ndis driver to specify com port ?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

>I think you are confusing 2 things, the NDIS top edge interface (ie IRPS) and

how to talk to your device (the bus interface). a pci based nic uses hw
registers and dma to talk the device. In usb, the driver uses IRPs. In this
case, the irps you use to talk to your device are irps you create, not irps you
receive from above. Look at the usbnwifi example on how to talk to a usb device
in an ndis miniport

Yes . thanks Doron.

besides i am also confusing that how to find the device (the usb interface in composite device) to send IRPs ,i know that i get the buffer from received callback and create IRP ,copy buffer , send package. i am looking at the usbnwifi . thanks !!!

You don’t find the device. If you load your NDIS miniport on top of the usb enumerated PDO (ie match on a hw id of USB\VID…) you just send IRPs DOWN the stack. Stop thinking like you have to open a com port, you don’t. the hw might be com port like in the type of commands you send to it, but that does not mean you need to send a create or serial device interface IOCTLs to it.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Sunday, March 06, 2011 11:46 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] NDIS Miniport driver for USB Com Port

I think you are confusing 2 things, the NDIS top edge interface (ie
IRPS) and how to talk to your device (the bus interface). a pci based
nic uses hw registers and dma to talk the device. In usb, the driver
uses IRPs. In this case, the irps you use to talk to your device are
irps you create, not irps you receive from above. Look at the usbnwifi
example on how to talk to a usb device in an ndis miniport

Yes . thanks Doron.

besides i am also confusing that how to find the device (the usb interface in composite device) to send IRPs ,i know that i get the buffer from received callback and create IRP ,copy buffer , send package. i am looking at the usbnwifi . thanks !!!


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

OK , i understand .

And in your point , i would like to ask the last 2 questions.

Could ndis driver rely on the both com port for that PIDVIDs are different at the same time?

and how to guarantee the ndis driver is at the top of Com port driver , setting in INF file ? or just the installation sequence with the same PIDVID.

Why would the 2 com ports’ vid and pid be different? You said it was the same piece of hw. Is it a complex USB device with an embedded hub or a composite device with 2sets of functional interfaces?

d

dent from a phine with no keynoard

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Monday, March 07, 2011 12:13 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] NDIS Miniport driver for USB Com Port

OK , i understand .

And in your point , i would like to ask the last 2 questions.

Could ndis driver rely on the both com port for that PIDVIDs are different at the same time?

and how to guarantee the ndis driver is at the top of Com port driver , setting in INF file ? or just the installation sequence with the same PIDVID.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

And yes your inf needs to install with the device’s USB hardware id as the pnp id it matches against.

d

dent from a phine with no keynoard

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Monday, March 07, 2011 12:13 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] NDIS Miniport driver for USB Com Port

OK , i understand .

And in your point , i would like to ask the last 2 questions.

Could ndis driver rely on the both com port for that PIDVIDs are different at the same time?

and how to guarantee the ndis driver is at the top of Com port driver , setting in INF file ? or just the installation sequence with the same PIDVID.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

>Why would the 2 com ports’ vid and pid be different? You said it was the same

piece of hw. Is it a complex USB device with an embedded hub or a composite
device with 2sets of functional interfaces?

I think ut is a composite device with 2 sets of functional interfaces.
like USB\VID_0001&PID_0001&MI_00
USB\VID_0001&PID_0001&MI_01

So instead of matching on the composite IDs (USB\VID_0001&PID_0001&MI_00) in your INF, match on the hw id (USB\VID_0001&PID_0001)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Monday, March 07, 2011 2:44 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] NDIS Miniport driver for USB Com Port

Why would the 2 com ports’ vid and pid be different? You said it was
the same piece of hw. Is it a complex USB device with an embedded hub
or a composite device with 2sets of functional interfaces?

I think ut is a composite device with 2 sets of functional interfaces.
like USB\VID_0001&PID_0001&MI_00
USB\VID_0001&PID_0001&MI_01


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer