README 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. pertd2 - A daemon that displays information on the Pertelian USB LCD display
  2. Overview:
  3. This program creates a fifo and listens to it for commands. The commands
  4. can be used to turn the backlight on/off, set the data of each line to
  5. display, stop the program, etc.
  6. If the lines are more than the 20 chars allowed for each line, the data is
  7. scrolled horizontally.
  8. The data will wrap into unused lines. Ex: if line 1 has data, but line 2 does
  9. not, the data from line 1 will wrap into line 2 and both lines will scroll at
  10. double speed.
  11. If there is no data to display, the current date/time will display.
  12. The interface to the daemon is through a fifo. The name and location
  13. of this fifo is set via a configuration file /etc/pertd2.conf
  14. Optionally, you can specify a configuration file on the pertd command line.
  15. The program is set to go daemon right away. So when you run pertd2,
  16. you will get a prompt back immediately as it goes off into the background
  17. and not be terminated when you log off.
  18. Note that on my system (Mandriva 2007), when the user logs off, ownership
  19. of /dev/ttyUSB0 goes back to root. So it's probably a good idea to run
  20. this daemon as root. See the service directory for turning pertd2 into
  21. a service that runs when the system boots.
  22. Configuration:
  23. delay_time -
  24. The interval between screen refreshes in ms. (1000000ms = 1 second)
  25. This will basically control how fast the Pertelian scrolls the data
  26. across the screen.
  27. Default: 500000 (1/2 second)
  28. char_delay -
  29. The delay between each character sent to the Pertelian. This delay prevents
  30. the program from sending data too fast and causing garbled output on the
  31. display. Newer systems may not need any delay, so I made this configurable.
  32. The delay is in ms. 1 ms is usually needed for old systems. If your
  33. display is very slow, reduce this to 0. If the output is garbled, put it
  34. to 1.
  35. Default: 1
  36. device -
  37. The device the Pertelian is on.
  38. Default: /dev/ttyUSB0
  39. fifo_name -
  40. The name of the fifo that pertd2 creates.
  41. backlight_mgt -
  42. Backlight management. This indicates whether you want pertd2 to
  43. manage the backlight or not. Basically it manages it by turning the
  44. backlight on when there is data to display and off when there is no data.
  45. 1 = pertd2 manages the backlight. 0 = it doesn't.
  46. Default: 0
  47. Commands:
  48. backlight on
  49. backlight off
  50. stop
  51. line1
  52. line2
  53. line3
  54. line4
  55. delay time
  56. char delay
  57. backlight mgt on
  58. backlight mgt off
  59. You communicate by sending the command to the fifo. ex:
  60. echo "backlight on" > /tmp/pertd2.fifo
  61. Most of the commands should be self-explanatory.
  62. The commands:
  63. backlight on
  64. backlight off
  65. stop
  66. backlight mgt on
  67. backlight mgt off
  68. are all single line commands.
  69. The "delay time" and "char delay" commands take a second line that specified
  70. the value. ex:
  71. delay time
  72. 500000
  73. The "line?" commands are a little more complex. ex:
  74. line1
  75. 600
  76. ==EOD==
  77. The quick brown fox jumped over the lazy dog.
  78. ==EOD==
  79. The first line (line1) is the command, also telling pertd2 which line
  80. you want this data to go in.
  81. The second line (600) is the number of seconds pertd2 should display the
  82. data. Basically an expiration time. 0 seconds means "don't expire."
  83. The third line is the end of data marker. It will not display.
  84. The rest of the lines are the data to be displayed. New lines will be
  85. converted to spaces. The data goes from the first EOD marker until it
  86. sees another line with the EOD marker, or until it his end of file (i.e.
  87. the fifo is empty).
  88. So, you can put these lines into a file:
  89. line1
  90. 12
  91. ==EOD==
  92. 19:26:59
  93. ==EOD==
  94. line2
  95. 12
  96. ==EOD==
  97. Testing
  98. ==EOD==
  99. then you can
  100. cat file > /tmp/pertd2.fifo
  101. to send the commands.
  102. The "sendcommands" directory contains examples of programs that send commands
  103. to the fifo.
  104. I release my code into the Public Domain. Have fun, but use this code
  105. and the resulting program at your own risk. --Ron Lauzon
  106. 2007/03/24 Created by Ron Lauzon