Preventing port power down

Hi everybody,

in Win2k, disabling a printer port, for example in Device Manager, frees the corresponding port addresses; any other driver can claim them thereafter. However, on some newer machines a disabled port appears to be completely defunct: WRITE_PORT_UCHAR shows no results at the connector pins.

My theory is that this happens with ACPI parallel ports only: I suppose Windows powers the hardware down when LPTx is disabled. If this theory holds (any idea how to proove it?), then how could I prevent this *without* totally replacing the Win2k parallel drivers?

Is Power Manager (or who else) sending an IRP_MN_SET_POWER request to parallel? Can I prevent this?

Or can I re-power the hardware through some API?

I’ll appreciate any ideas.

Thanks in advance.

Manfred


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Manfred,

Yes, I believe you are correct. If I remember correctly, an ACPI driver acts as a bus enumerator and allows the I/O & IRQ’s to be used when a driver is attached to the hardware otherwise the hardware is turned off.

If possible you should layer your driver on top of the parallel port driver, otherwise you will probably need to write a driver and installation file to use the hardware. You can then use the device manager’s “update driver” functionality to replace the win2k supplied driver with your own. You can also use the SetupDi functions to swap drivers on-the-fly if thats what you require. (To allow different drivers to be loaded for different devices connected to the port)

Another solution I have heard ( from Microsoft ) was to extend the functionality of the lpt driver to temporarily “give up” its I/O resources to a calling driver. In this situation your driver would open “LPT1” and issue an IOCTL to get its hardware resources. Your driver would use the resources till it was done with them, issue another IOCTL to the LPT driver giving back its resources. This solution allows faster switching of drivers, but still requires the “enhanced” LPT driver to be installed over the standard driver.

Larry

-----Original Message-----
From: xxxxx@goldmail.de [mailto:xxxxx@goldmail.de]
Sent: Monday, October 22, 2001 12:13 PM
To: NT Developers Interest List
Subject: [ntdev] Preventing port power down

Hi everybody,

in Win2k, disabling a printer port, for example in Device Manager, frees the corresponding port addresses; any other driver can claim them thereafter. However, on some newer machines a disabled port appears to be completely defunct: WRITE_PORT_UCHAR shows no results at the connector pins.

My theory is that this happens with ACPI parallel ports only: I suppose Windows powers the hardware down when LPTx is disabled. If this theory holds (any idea how to proove it?), then how could I prevent this *without* totally replacing the Win2k parallel drivers?

Is Power Manager (or who else) sending an IRP_MN_SET_POWER request to parallel? Can I prevent this?

Or can I re-power the hardware through some API?

I’ll appreciate any ideas.

Thanks in advance.

Manfred


You are currently subscribed to ntdev as: xxxxx@diebold.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Larry,

Thank you for your detailed reply.

So if I could just find some way to disable LPTx *and* tell ACPI to keep the parallel port powered on. If I get you right, you see no other way than installing another driver:

an ACPI driver
acts as a bus enumerator and allows the I/O & IRQ’s to be used when a
driver is attached to the hardware otherwise the hardware is turned off.

Bad luck?

You can then use the device
manager’s “update driver” functionality to replace the win2k supplied
driver with your own.

You are talking about UpdateDriverForPlugAndPlayDevices?

You can also use the SetupDi functions to swap
drivers on-the-fly if thats what you require.

With SetupDiInstallDevice?

I’m afraid that the main problem with both methods is that the driver in case is a legacy driver, and it looks to me that the whole Setup API requires PnP drivers. I haven’t the time to rewrite the driver to PnP just to get it to work on the parallel port (it normally accesses custom hardware).

Another solution I have heard ( from Microsoft ) was to extend the
functionality of the lpt driver to temporarily “give up” its I/O resources
to a calling driver.

Yes, I already wrote such a driver years ago, and it works fine. However, *only* on the parallel port; as mentioned above, I need a solution for parallel *and* custom ports.

Manfred


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You could try looking for the ACPI enumerator documentation. As an enumerator, it will support many IOCTLs, and it may have some extra ones.

You can then use the device
manager’s “update driver” functionality to replace the win2k supplied
driver with your own.
>You are talking about UpdateDriverForPlugAndPlayDevices?

No, I mean you can actually use the device manager, select the lpt1 port and perform an “update driver” operation to get your driver installed (no programming required).

When I said on-the-fly I meant using UpdateDriverForPlugAndPlayDevices()

Yes, Microsoft locked up the serial and parallel ports when they implemented PnP. I believe they would like to see everyone use USB or FireWire.

Larry
-----Original Message-----
From: xxxxx@goldmail.de [mailto:xxxxx@goldmail.de]
Sent: Tuesday, October 23, 2001 6:29 AM
To: NT Developers Interest List
Subject: [ntdev] Preventing port power down

Larry,

Thank you for your detailed reply.

So if I could just find some way to disable LPTx *and* tell ACPI to keep the parallel port powered on. If I get you right, you see no other way than installing another driver:

an ACPI driver
acts as a bus enumerator and allows the I/O & IRQ’s to be used when a
driver is attached to the hardware otherwise the hardware is turned off.

Bad luck?

You can then use the device
manager’s “update driver” functionality to replace the win2k supplied
driver with your own.

You can also use the SetupDi functions to swap
drivers on-the-fly if thats what you require.

With SetupDiInstallDevice?

I’m afraid that the main problem with both methods is that the driver in case is a legacy driver, and it looks to me that the whole Setup API requires PnP drivers. I haven’t the time to rewrite the driver to PnP just to get it to work on the parallel port (it normally accesses custom hardware).

Another solution I have heard ( from Microsoft ) was to extend the
functionality of the lpt driver to temporarily “give up” its I/O resources
to a calling driver.

Yes, I already wrote such a driver years ago, and it works fine. However, *only* on the parallel port; as mentioned above, I need a solution for parallel *and* custom ports.

Manfred


You are currently subscribed to ntdev as: xxxxx@diebold.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> Hi everybody,

in Win2k, disabling a printer port, for example in Device Manager, frees
the corresponding port addresses; any other driver can claim them
thereafter. However, on some newer machines a disabled port appears
to be completely defunct: WRITE_PORT_UCHAR shows no results at the
connector pins.
[snip]
Or can I re-power the hardware through some API?

No but you can keep the existing parallel driver loaded and make your
driver a client. This way the port will remain powered with no hacks
required. Checkout \ddk\inc\ddk\parallel.h for the kernel mode interface
available. Its has documentation in the DDK (search for
IOCTL_INTERNAL_PARALLEL). I used the NT4 version of this interface to get
the base address of the parallel port and to claim the port for exlcusive
access. The Win2k interface looks like it is more powerful (the NT4 one
still works though).

Mike


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Larry,

Thanks again for your comments.

You could try looking for the ACPI enumerator documentation. As an
enumerator, it will support many IOCTLs, and it may have some extra ones.

Probably it has. But I haven’t found any documentation for them, at least not in my DDK. Instead it says “Drivers must make no assumptions about the presence or absence of an ACPI filter…” . Perhaps there’s a way to disable ACPI altogether, I’ll start a new thread on this.

>No, I mean you can actually use the device manager, select the lpt1 port and perform an “update driver” operation to get your driver installed (no programming required).

But will Windows accept “updating” to a driver that isn’t even PnP? As mentioned, it’s an old legacy dog, without even an .INF. And since at least parallel and parvdm expect some functionality, won’t it end up in desaster plugging in some totally ignorant driver?

Manfred


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

To “update” the lpt driver you would definately need a .inf file and your “old” driver will probably need PnP support added. This is what I had to do to “port” an NT 4.0 driver which used the RS232 I/O and IRQ to Win2k.
The old driver simply started before the NT serial.sys driver and grabbed the hardware resources before serial.sys could.
Under Win2K this simply won’t work. You are probably going to have to bite the bullit and write the code.

Larry

-----Original Message-----
From: xxxxx@goldmail.de [mailto:xxxxx@goldmail.de]
Sent: Wednesday, October 24, 2001 11:46 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Preventing port power down

Larry,

Thanks again for your comments.

You could try looking for the ACPI enumerator documentation. As an
enumerator, it will support many IOCTLs, and it may have some extra ones.

Probably it has. But I haven’t found any documentation for them, at least not in my DDK. Instead it says “Drivers must make no assumptions about the presence or absence of an ACPI filter…” . Perhaps there’s a way to disable ACPI altogether, I’ll start a new thread on this.

>No, I mean you can actually use the device manager, select the lpt1 port and perform an “update driver” operation to get your driver installed (no programming required).

But will Windows accept “updating” to a driver that isn’t even PnP? As mentioned, it’s an old legacy dog, without even an .INF. And since at least parallel and parvdm expect some functionality, won’t it end up in desaster plugging in some totally ignorant driver?

Manfred


You are currently subscribed to ntdev as: xxxxx@diebold.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com