LAN over USB

Hi.

Is there any way for an NDIS driver to know, if it is on an NDIS stack build over a LAN USB device, that the USB cable was unplugged? I’m trying to avoid writing a USB driver for that purpose…

Thanks

I guess that you are talking about a NDIS filter or protocol driver…

I don’t know of a way that the driver by itself can find this out. However, you can write a companion Notify Object (NO) DLL that can determine this at install time. The NO can use the INEtCfg GetId API to fetch the lower-level PnP Device ID. For USB the device IS would have the form “usb\vid_2001&pid_1a00”, for example. A PCI device PnP device ID would have the form “pci\ven_8086&dev_100e&subsys_002e8086”, for example.

The NO could veto binding your filter to USB devices. Alternatively, it could write information to a location in the registry where the driver could fetch it at DriverEntry.

This might get complex if your filter or protocol driver is bound over other filter drivers. If so, then the PnP ID of the lower device might not be that of the physical device.

Hope this helps.

Thomas F. Divine
http://www.pcausa.com

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-325264-
xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Monday, May 26, 2008 6:24 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] LAN over USB

Hi.

Is there any way for an NDIS driver to know, if it is on an NDIS stack
build over a LAN USB device, that the USB cable was unplugged? I’m
trying to avoid writing a USB driver for that purpose…

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

Perhaps you could back up and explain what you are trying to accomplish
without narrowing the solution to only this method. First of all:

  • what is “an NDIS driver”? An NDIS IM driver? An NDIS Protocol only?
  • when this driver learns that the “USB cable was unplugged” what is it
    going to do?
  • what event in the system occurs that is is otherwise indistinguishable
    from that which happens when the USB cable is unplugged and you want to deal
    with differently?
  • what does your solution do when the USB device is re-enumerated on the
    bus? How about on a different USB port (and your device does not have a
    serial number and ends up as a ‘different’ device, etc., etc.)?

Attempting to treat a USB bus removal as an Media Disconnect is going to be
a real trick. It will require a rather curious set of behaviors in an IM
driver (keeping the virtual miniport even when the last/only protocol
binding has been removed). Of course I am only guessing that that is what
you are trying to deceive the system into believing. Perhaps your real
problem to solve is different and will have a far more approachable
solution.

Please know that I ask because I don’t want accidently lead you or this
thread into a quagmire!

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development


From:
Sent: Monday, May 26, 2008 6:23 AM
To: “Windows System Software Devs Interest List”
Subject: [ntdev] LAN over USB

> Hi.
>
> Is there any way for an NDIS driver to know, if it is on an NDIS stack
> build over a LAN USB device, that the USB cable was unplugged? I’m trying
> to avoid writing a USB driver for that purpose…
>
> 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
>

Why is usb important? b/c it can be surprise removed by the user? What about a pccard/pcmcia/xpress card NIC? They too can be surprise removed. What is it your trying to do /determine?

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Monday, May 26, 2008 3:24 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] LAN over USB

Hi.

Is there any way for an NDIS driver to know, if it is on an NDIS stack build over a LAN USB device, that the USB cable was unplugged? I’m trying to avoid writing a USB driver for that purpose…

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

Maybe I’ve phrased the question badly.
I was trying to determine if there was some way an NDIS filter device knows, when it is in a stack build over a “virtual” NIC (say I plugged a PDA in), that the USB cable was unplugged.

The answer was, that the filter device’s detach() method was called when the cable was pulled out…

I have another relating question - Is there a way to know the same about a Wi-Fi ?
say a connection was established between my desktop PC (running my NDIS driver) and a Lap top’s wireless NIC, and then the lap top was turned off - would my driver be able to tell the lap top is no longer present, without having to send a constant “keep-alive” message?

Thanks
Can the

… and the attachment of your desktop pc (the point where you are trying to observe the connectivity of the laptop from) is Ethernet? AdHoc Wireless? What?

I think the short answer is no. The LAN is does not report any ‘events’ when stations attach an detach. The ancillary fact that the laptop is attached via a 802.11 bridge is both unobservable and transparent to any other station attached to the LAN (other than the Access Point managing the association).

The only way to know a station’s attachment status is to communicate with it. It failing to respond after some period of time is the best estimate you can get of it being detached from the LAN.

Now in the very special case of ‘ad-hoc’ WiFi connections whereby the LAN is established directly between ‘peer’ stations, there are 802.11 management frames emitted by the laptop (and desktop) WiFi adapters to maintain presence in the ad-hoc network. Whether or not your filter can observe these frames or even if it is worth doing so given that it only would be modestly useful with ad-hoc operation is another question.

Are we to infer from

The answer was, that the filter device’s detach() method
was called when the cable was pulled out…

That you are talking about NDIS 6 (light-weight) Filter drivers?

My apologies for jumping to a conclusion that you were trying to manage media-connect for the interface stack. I really have no clue what your actual goal is here. At the NDIS (MAC) level, the only thing(s) you can know from the ‘system’ are:

  1. Is there an attachment to a network? (aka, a NIC device present in the system)
  2. Is the attachment ready to be used? (powered up)
  3. Is the attachment ‘connected’ to the network? (media status)
    3a (NDIS6) Is the attachment ‘authorized’ to exchange packets on the network.

There is nothing you can learn about *other* stations without exchanging packets.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Tuesday, May 27, 2008 2:15 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] LAN over USB

Maybe I’ve phrased the question badly.
I was trying to determine if there was some way an NDIS filter device knows, when it is in a stack build over a “virtual” NIC (say I plugged a PDA in), that the USB cable was unplugged.

The answer was, that the filter device’s detach() method was called when the cable was pulled out…

I have another relating question - Is there a way to know the same about a Wi-Fi ?
say a connection was established between my desktop PC (running my NDIS driver) and a Lap top’s wireless NIC, and then the lap top was turned off - would my driver be able to tell the lap top is no longer present, without having to send a constant “keep-alive” message?

Thanks
Can the


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

Thanks for your reply Dave.

I was talking about the NDIS 6 lightweight filter and not about some ‘ad-hoc’ WiFi protocol or device.

I see the only option is to try and talk with a device via wireless LAN, and in the case of a timeout, decide I lost connectivity.

Thanks again,
Ariel.

> I was trying to determine if there was some way an NDIS filter device knows,

when it is in a stack build over a “virtual” NIC (say I plugged a PDA in),
that the
USB cable was unplugged.

USB cable unplugs -> NIC device surprise removed -> NDIS kills the binding ->
the IM is invoked to kill its binding representation

Is this wrong?


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com