> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man4/lpt.4.md).

# lpt.4

`lpt` — 通用打印机设备驱动

## 名称

`lpt`

## 概要

`device ppc device ppbus device lpt`

## 描述

当前的 *lpt* 驱动是原始 lpt 驱动向 [ppbus(4)](/man/man4/ppbus.4.md) 系统的移植。

此次移植的一个目的是允许与其他并行设备共享并行端口。其次，inb()/outb() 调用已被 ppbus 函数调用取代。得益于 ppbus 接口，lpt 现在与架构无关。有关 ppbus 系统的更多信息，请参见 [ppbus(4)](/man/man4/ppbus.4.md)。

打开打印机设备时，lpt 会分配并行端口总线，仅在传输完成时释放：即设备关闭时，或在中断驱动模式下整个缓冲区发送完毕时。

驱动可配置为中断驱动或轮询打印机。配置为中断驱动的端口可使用 lptcontrol(8) 命令切换到轮询模式。

根据硬件情况，可使用 lptcontrol(8) 命令配置扩展功能。对于 ECP/ISA 端口，可利用 FIFO 和 DMA。

要从 /dev/lpt0 获取打印机信息，只需对设备应用 `cat` 命令。如果打印机支持 IEEE1284 半字节模式且有数据要发送给主机，你将获取到这些数据。

## 文件

**`/dev/lpt0`** 第一个并行端口驱动

## 参见

[ppbus(4)](/man/man4/ppbus.4.md), [ppc(4)](/man/man4/ppc.4.md), lptcontrol(8)

## 历史

此驱动取代了现已废弃的 lpa 驱动的功能。

## 缺陷

缺陷很多，尤其是在廉价的并行端口实现中。

只有当打印机已连接并在线时才能打开 lpt 端口，这使得没有连接打印机时无法运行 lptcontrol(8)。

此驱动仍有重写的空间。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man4/lpt.4.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
