[英]what is the OSX version of Linux's /dev/usb/lp0?
I'm writing to a centronics cable and blinking some LEDs via a simple "bufferized" circuit. 我正在写一个centronics电缆,并通过一个简单的“缓冲”电路闪烁一些LED。
I'm able to write out the bits via C code referencing the device location on /dev/usb/lp0 on an Ubuntu machine. 我能够通过引用Ubuntu机器上/ dev / usb / lp0上的设备位置的C代码写出这些位。
However, I'd like to be able to do this on OSX Mavericks. 但是,我希望能够在OSX Mavericks上做到这一点。 I don't see the same type of device file as I do in Linux.
我没有看到与Linux中相同类型的设备文件。
ie is there an OSX analog to /dev/usb/lp0 on Linux? 即在Linux上是否有/ dev / usb / lp0的OSX模拟?
Thanks much. 非常感谢。
Under the concept of "everything's a file" lp0 is just a special file that allows raw access to a device, in this case a 'special character file' for the first parallel device. 在“一切都是文件”的概念下,lp0只是一个允许对设备进行原始访问的特殊文件,在这种情况下是第一个并行设备的“特殊字符文件”。 The same would exist on OSX if a driver was present that matched the device, or something like
/dev/parport0
. 如果存在与设备匹配的驱动程序或类似
/dev/parport0
,OSX上也会存在相同的情况。 OSX has a pretty limited collection of parallel drivers though. OSX虽然拥有非常有限的并行驱动程序集合。 You could try to fudge it - create a 'character' device file pointing it to some generic parallel driver with
mknod
. 你可以尝试捏造它 - 创建一个'字符'设备文件,用
mknod
指向一个通用的并行驱动程序。
eg mknod lp0 cxy
where x an y are the major and minor numbers for the device type. 例如
mknod lp0 cxy
其中x和y是设备类型的主要和次要数字。 Typically you find these numbers in the documentation/devices.txt
file on linux, not sure where this info is on OSX though. 通常,您可以在linux上的
documentation/devices.txt
文件中找到这些数字,但不确定此信息在OSX上的位置。
I've seen devices handle this using generic printer drivers, such as a "gadget printer": https://www.kernel.org/doc/Documentation/usb/gadget_printer.txt 我见过设备使用通用打印机驱动程序来处理这个问题,例如“小工具打印机”: https : //www.kernel.org/doc/Documentation/usb/gadget_printer.txt
(my initial assumption) (我最初的假设)
In this case the device will actually show up on the system as a printer. 在这种情况下,设备实际上将作为打印机显示在系统上。 You can find a list of printers and their location using CUPS utilities like lpstat:
您可以使用CUPS实用程序(如lpstat)找到打印机列表及其位置:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/lpstat.1.html#//apple_ref/doc/man/1/lpstat https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/lpstat.1.html#//apple_ref/doc/man/1/lpstat
There's also the environment variables LPDEST and PRINTER which should list the default print location: 还有环境变量LPDEST和PRINTER ,它们应该列出默认的打印位置:
echo $LDPEST
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.