-
Notifications
You must be signed in to change notification settings - Fork 13
/
README
221 lines (166 loc) · 9.06 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
dcled - userland driver for Dream Cheeky (Dream Link?) USB LED Message Board
Copyright 2009,2010,2011 Jeff Jahr <[email protected]>
This is free software. G'head, use it all you want. Because of the use of
libhid, however, this might now be considered GPL licensed. I kind of like the
Artistic License myself. Anyway, if you are planning to incorporate this code
into your product or are otherwised concerned about the licensing, have your
people contact my people and we'll work it out.
Version 1.0 took ~12 hours to write, and was my first foray into usb device
programming. This is probably not a real good example of how to do ANYTHING.
Dcled runs on linux, and perhaps other operating systesm. To use it, you need
to have the usb hiddev loaded- on my system that seems to be the module named
'usbhid', and it is loaded by default. When you plug in the message board, the
system ought to see it and create an entry in /dev/usb/hiddev* for it. You can
check if the device is loaded correctly with this command:
lsusb -d 1d34:0013 -v
That out to output a whole lot of stuff that you probably dont care about-
unless it outputs nothing. If it outputs nothing, then you have a problem with
your usb. Or maybe you have message board with a different vendor and product
id.
BUILDING IT:
As of dcled version 1.4, you are going to need a copy of the libhid-dev files
in order to build dcled. If you are running debian or ubuntu, try running
'apt-get install libhid-dev' to get the right files installed.
Type 'make'. That should build an executable called 'dcled'. If that doesnt
work, try compling it by hand. There is an install option in the makefile. If
the first make command was successful, run 'make install' as root to copy the
executable into /usr/local/bin.
As of dcled version 1.8, there is a linux udev rules file that will set the
permissions of the dcled device such that members of the plugdev group can
access the hardware without being root. It seems to work pretty well under
Ubuntu linux, but it isn't very well tested elsewhere and I can't vouch for how
will it will work under other OS's. If you want to give it a shot, type
'make udev'. That will copy the file into place and restart the udev
subsystem.
RUNNING IT:
You are going to need read/write access to the mesage board device in order to
use dcled. This means you can either run dcled as root, suid the exe, or
figure out how to set the device permissions under hotplug if the method
suggested by the installation instructions didn't work for you. If you choose
to run it as root, do try not to hurt anything. You've been warned.
Usage- ./dcled [opts] [files]
--brightness -b How bright, 0-2
--clock -c Show the time
--clock24h -C Show the 24h time
--bcdclock -B Show the time in binary
--debug -d Mostly useless
--echo -e Send copy to stdout
--help -h Show this message
--message -m A single line message to scroll
--nodev -n Don't use the device
--preamble -p Send a graphic before the text.
--repeat -r Keep scrolling forever
--fastprint -f Jump to end of message.
--speed -s General delay in ms
--test -t Output a test pattern
Available preamble graphics:
1 - dots - A string of random dots
2 - static - Warms up like an old TV
3 - squiggle - A squiggly line
4 - clock24 - Shows the 24 hour time
5 - clock - Shows the time
6 - spiral - Draws a spiral
7 - fire - A nice warm hearth
8 - bcdclock - Shows the time in binary
I set up dcled so that it works like cat. If you run dcled with a list of
files, it will cat each of those files to the message board. If you dont name
any files at all, dcled reads from stdin, so that you can use it as a pipe.
There is also the --message="" option in case you want to send a single line to
it.
EXAMPLES:
Run a test pattern:
dcled -t
Hello World:
dcled -m 'Hello World!'
Hello World part 2:
echo 'Hello World!' | dcled
Hell World part 3:
echo Hello >f1
echo Hello >f2
dcled f1 f2
If you want to have dcled run as a clock all the time, try adding using the clock and repeat options.
dcled --clock --repeat
As of dcled 1.6, you can call the preamble type either by number or by name:
dcled -p static -m "Hello World"
dcled -p 2 -m "Hello World"
To see a demo of all the preamble types, run the test pattern:
dcled --test
Here is how I use it to monitor my game server syslog file:
tail -f syslog | dcled -e -p static
WHAT IS UP WITH BCDCLOCK?
A couple of the guys at work have these LED desk clocks that show the time in a
form of binary notation called 'BCD'. That stands for 'binary coded decimal'.
The clock is showing the time like normal- 2:25:29 for twenty nine seconds
after two twentyfive for example- but instead of printing it like normal, each
digit is printed as a column of binary bits. The 1 bit is at the bottom of the
screen, with 2, 4, and then 8 on top of it. Here is an example-
.....................
.....................
.....................
.................O...
...........O.........
.....O...O.....O.....
...........O.....O...
0 2 2 5 2 9
Having a BCD clock on your desk is pretty geeky... but I think having a USB
programmable one that can scroll messages too is even better!
WHAT IS UP WITH THE FONT FILE FORMAT?
I was cleaning out my postmaster mail box and saw that Stefan Misch was having
a hard time mailing me at my usual adress. Its a good thing that I thought to
clean up the postmaster box, becuase it turns out he had submitted a patch that
hard coded three new fonts into dcled!
I felt really bad about having that patch sit around unseen for over a month,
so to make up for it, I decided it was time to add loadable font files to
the project. That, and it was raining.
If you want to add a font of your own, check out one of the .dlf files included
in the distribution. The first five lines of the file are the header, and are
order dependant. i.e. The "Descirption" data has to appear on the third line
of the file.
After the header comes the individual character definitions. Each charater is
defined on an 8x7 bitmap. The Size parameter in the header tells how much of
the 8x7 bitmap is actually used by the font. The characters don't all have to
be defined, and they don't have to appear in order in the file. The first
two-digit hex number determines which ascii character being defined. The next
character is skipped by dcled, it is just there as a human readable hint for
what the character is. The next seven numbers are the row data for the
character bit patterns.
The default location for font files is /usr/local/share/dcled. Put your .dlf
file into that location and dcled will try to load it.
WHAT IS UP WITH MOVING TO LIBHID?
I got a message from Sam Dineley about a problem he was having with dcled under
kernel 2.6.24. It looks like there is a problem with the linux usbhid driver
that is causing a large number of warnings to be klogged when the display is in
use. I bumped my kernel to 2.6.26 and am getting the same problem. The display
still seems to work, although it is very slow, and the error messages fill up
the logs. Sadly, it seems that the usb bus will eventually lock up too under
these conditions.
I started looking at what could be going wrong, but this is an area of the
system that I have no familiarity with at all- this program was my first visit
into the land of usb programming. This looks to be a problem with the linux
usbhid driver, but maybe there is something that my program or the messageboard
hardware is doing to trigger the problem? Who knows. As soon as I saw the
linux hid 'quirks' section in the kernel, I figured that this was an area of
experimentation that would have to wait for some other rainy afternoon. I'm in
California and we are in the middle of a drought, so there it sat.
In the mean time, Michael Wensley was smart enough to make dcled work with
libhid, and kind enough to show me how he did it. It seems to work without
error on my systems, so there we go! Problem solved.
CREDITS:
I used the docs written by Alvin Wong of Dream Link to get the device protocol
right. Way to go with releasing hardware specs! Awesome!
I took the font data from pictures of the X11 "5x7" font. Its a long story.
Additional contributions made by:
* Sam Dineley - Bug reports
* Andy Scheller - Clock code, redrew the 'g', great feedback
* Michael Wensley - Application of libhid clue stick
* James Bruce - First to get it to compile under Mac OSX.
* Glen Smith - Wrote the spiral and fire animations.
* Raymond - Initial udev rules file
* Thomas Ilnseher - Bug reports
* Robert Flick - Fast Print mode for keeping a still message displayed,
Mac Homebrew build formula.
* Stefan Misch - Created the small, sga, and small_inv fonts
If you want to contribute to dcled, send me your code diffs! Be sure to
specifiy if you DONT want me to include your name or email address in the
credits.
-jsj