15809

Communicate between a linux device and Perl scripts

Question:

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.

Answer1:

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.

Answer2:

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 <a href="http://linux.die.net/man/2/ioctl" rel="nofollow">ioctl</a> commands on the device file.

Recommend

  • NHibernate Component inheritance
  • WPF DataGrid lost focus after row delete
  • Default CUDA addition rounding mode between cuda 5.0 and 7.5
  • How do I control the soft menu button in Honeycomb?
  • Hudson dependencies
  • Why are `colMeans()` and `rowMeans()` functions faster than using the mean function with `lapply()`?
  • bit shift multiplication in c not using powers of 2 [duplicate]
  • Getting errors while using neuralnet function
  • Zend Framework + Doctrine1.2 project structure with more modules
  • File extension of zlib zipped html page?
  • Fail:(TESTMODE) Transactions of this market type cannot be processed on this system
  • Moving Android View and preventing onDraw to be called over and over again
  • Installed module is empty
  • Custom Tabgroup Appcelerator
  • iOS: Detect app start via notification press
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Initializer list vs. initialization method
  • Control modification in presentation layer
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • Android screen density dpi vs ppi
  • Different response to non-authenticated users and AJAX calls
  • Fetching methods from BroadcastReceiver to update UI
  • C# - Serializing and deserializing static member
  • HTML download movie download link
  • JavaScriptCore crash on iOS9
  • How would I use PHP exceptions to define a redirect?
  • Excel - Autoshape get it's name from cell (value)
  • Incrementing object id automatically JS constructor (static method and variable)
  • Check if a string to interpolate provides expected placeholders
  • How to extract text from Word files using C#?
  • Do create extension work in single-user mode in postgres?
  • RestKit - RKRequestDelegate does not exist
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Traverse Array and Display in markup
  • How to disable jQuery.jplayer autoplay?
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • coudnt use logback because of log4j
  • need help with bizarre java.net.HttpURLConnection behavior