Communicate between a linux device and Perl scripts

可紊 提交于 2019-12-12 12:26:53

问题


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.


回答1:


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.

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.




回答2:


There are two ways of doing this: Either have one or more files in e.g. /proc that is written to or read from.

The second is to use special ioctl commands on the device file.



来源:https://stackoverflow.com/questions/20138945/communicate-between-a-linux-device-and-perl-scripts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!