在linux设备和Perl脚本之间进行通信 [英] Communicate between a linux device and Perl scripts

查看:69
本文介绍了在linux设备和Perl脚本之间进行通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个书面的Linux设备(作为接口实现)和一个perl脚本,我需要这两个脚本在执行(从perl到设备)时在它们之间进行通信.我已经考虑过写入文件并从中读取文件.但我认为这不是理想的选择.谁能指出我一个更好的解决方案.

I have a written Linux device (implement as a interface) and a perl script, I need those two to communicate among them while executing(perl to device). I have thought of writing to a file and reading from it. but i think it is not an ideal one. can any one point me to more good solution.

推荐答案

除了上述提到的方法之外,Joachim还考虑创建字符或块设备,以便您可以通过/dev/somenode访问它.如果您的驱动程序确实提供了设备的服务或接口,那可能是首选的方式.

In addition to the methods Joachim mentioned also look into creating a character or block device so you can access it through /dev/somenode. That's probably the preferred way if your driver is really offering a service or an interface to a device.

或者,比起ioctl()接口,您可以使用netlink套接字.实际上,它们比ioctl()更容易实现,并且更有可能在上游被接受.

Alternatively, and better than an ioctl() interface, you can use netlink sockets. They're actually even easier to implement than ioctl()s, and are more likely to be accepted upstream.

这篇关于在linux设备和Perl脚本之间进行通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆