如何在Linux中找到USB转并口设备的基地址?

发布于 2024-10-31 01:31:50 字数 230 浏览 2 评论 0原文

我正在 Ubuntu 中用 C 语言进行 IO 编程。我需要端口的基地址来写入数据。

我的笔记本电脑没有并行端口。所以我买了一个 USB 转并行端口连接器。我插入设备并在 /dev/usb/lp0 中检测到它,

我运行“lsusb”来查看设备列表,我也可以看到 ID。但是我怎样才能得到基地址呢?对于通常的硬件并行设备来说,基地址是0x0378。使用 USB 转并行设备时未检测到此地址。

请帮忙。

I am doing IO programming in C in Ubuntu. And I need the base address of the port to write data.

My laptop dont have a parallel port. So I bought a USB to Parallel port connector. I plugged in the device and its getting detected in /dev/usb/lp0

I ran "lsusb" to see the list of devices and I can see the ID also. But how can I get the base address ? For the usual hardware parallel devices, the base address is 0x0378. this address is not getting detected while using USB to Parallel device.

Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清音悠歌 2024-11-07 01:31:50

USB 并行端口没有基址 - 这对于 USB 来说不是一个有意义的概念。恐怕通过 inout 指令在 PC 硬件上执行 I/O 的日子几年前就结束了,尽管许多旧教程仍然存在于网络上。

您可以将字节作为字符设备写入并行端口,这些字节将出现在打印机端口引脚上。 USB 适配器将期望另一端像打印机一样完全握手数据。如果您想要进行通用 I/O 原型设计,那么使用简单的 USB 微控制器(例如 Arduino)可能会更好。

此处进一步讨论。

A USB parallel port doesn't have a base address - it's not a meaningful concept for USB. I'm afraid the days of doing I/O on PC hardware via in and out instructions ended a few years ago, though lots of old tutorials still survive on the web.

You can write bytes to the parallel port as a character device, and these will appear on the printer port pins. The USB adapter will expect the other end to handshake data exactly like a printer. If you want to do general I/O prototyping, you're probably better off with a simple USB microcontroller like an Arduino.

Further discussion here.

仲春光 2024-11-07 01:31:50

如果您仍然有兴趣使用此 USB 到并行打印机设备进行自己的位操作,请务必了解其内置固件始终允许控制 D0.. D7INIT(作为输出)、/ERRONLPE(作为输入) ,但/ACKBUSY(输入)、/STB/AF从不 strong>、/SEL(输出)引脚。
并且您需要一个8位锁存器(例如74HCT574)来在选通时捕获数据。

请参阅此处 (https://www-user.tu-chemnitz.de/~ygu/巴斯特莱克/PC/USB2LPT/faq#DIY
特别是对于可能的数据速率。

从软件方面访问有点复杂但可能,并且您可能需要重新构建软件和硬件才能使此类适配器可用。我不知道 Linux 情况下如何访问,但恕我直言,你不需要编写内核模式驱动程序。

If you are still interested to use this USB-to-parallel-printer device for your own bit-banging, it's important to know that their built-in firmware always allows controlling of D0..D7, INIT (as outputs), /ERR, ONL, PE (as inputs), but never for /ACK, BUSY (inputs), /STB, /AF, /SEL (outputs) pins.
And you need an 8-bit latch (e.g. 74HCT574) for catching data while strobing.

See here (https://www-user.tu-chemnitz.de/~ygu/bastelecke/PC/USB2LPT/faq#DIY)
especially for possible data rates.

Accessing from software side is a bit complicated but possible, and you may have to re-structure your software and hardware for making such adapters useable. I don't know for Linux case how to access, but IMHO you don't need to write a kernel-mode driver.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文