Debian Codegraph @

debian/README.Debian

raw
1 RXTX - Full Java CommAPI implementation
2 =======================================
3
4 This package contains a full implementation of the Java CommAPI from Sun. To
5 use applications, written with the original CommAPI, with rxtx you have to
6 change references to javax.comm.* to gnu.io.*.
7
8 The rest of this file contains some useful information about problems with the
9 rxtx package found in the upstream INSTALL file. The unimportant sections are
10 left out.
11
12 -------------------------------------------------------------------------------
13 3. COMMON PROBLEMS
14
15 [...]
16
17 B. Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in
18 java.library.path
19
20 librxtxSerial.so is located in the wrong directory. Here is an example
21
22 $ mv /usr/local/java/jre/lib/i386/librxtxSerial* /usr/local/lib
23 $ java BlackBox
24 Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial
25 in java.library.path
26 at java.lang.ClassLoader.loadLibrary(Compiled Code)
27 at java.lang.Runtime.loadLibrary0(Compiled Code)
28 at java.lang.System.loadLibrary(Compiled Code)
29 at gnu.io.NativePort.<clinit>(NativePort.java:32)
30 at gnu.io.RXTXPort.<init>(Compiled Code)
31 at gnu.io.RXTXCommDriver.getCommPort(Compiled Code)
32 at gnu.io.CommPortIdentifier.open(Compiled Code)
33 at SerialPortDisplay.openBBPort(Compiled Code)
34 at SerialPortDisplay.<init>(Compiled Code)
35 at BlackBox.addPort(Compiled Code)
36 at BlackBox.main(Compiled Code)
37
38 ... lets fix it.
39
40 Solution 1: move the file to a place that works
41
42 $ mv /usr/local/lib/librxtxSerial.* /usr/local/java/jre/lib/i386/
43
44 Solution 2: add the location of librxtxSerial to LD_LIBRARY_PATH
45
46 $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
47
48 Solution 3: pass the location in on the command line
49
50 $ java -Djava.library.path=/usr/local/lib/ ...
51
52 C. I Can Not Open the Port.
53
54 If you're not able to open the port (read the errors carefully) then you
55 may not have permission to use the device. Redhat Linux ships with the
56 following permissions:
57
58 crw-r--r-- /dev/ttyS?
59
60 Users need to be able to read and write with serial communication...
61
62 chmod 666 /dev/ttyS?
63
64 should fix the problem. Be sure to check the file CommAPI for common
65 mistakes.
66
67 Make sure that the user can create lock files.
68
69 D. java.lang.NoClassDefFoundError: gnu/io/CommPort
70
71 RXTXcomm.jar is probably not in your classpath or not located in
72 the proper directory.
73
74 for example, lets not include RXTXcomm.jar
75
76 export CLASSPATH=../java/lib/classes.zip
77 $ java BlackBoxException in thread "main"
78 java.lang.NoClassDefFoundError: gnu/io/CommPort
79
80 [...]
81
82 H. BlackBox Can Not Handle all the ports!
83
84 BlackBox has a hard coded limit in BlackBox.java that prevents it from
85 running if you don't specify a port. We are considering alternative
86 ways of handling the large number of port names in Unix. The line in
87 question
88
89 is:
90
91 portDisp = new SerialPortDisplay[50];
92
93 just change 50 to say 256.
94
95 I. Illegal use of nonvirtal function call!
96
97 Exception in thread "main" java.lang.VerifyError: (class:
98 gnu/io/RXTXPort$SerialOutputStream, method: flush signature: ()V)
99 Illegal use of nonvirtual function call
100 at gnu.io.RXTXCommDriver.getCommPort(Compiled Code)
101 at gnu.io.CommPortIdentifier.open(Compiled Code)
102 at SerialPortDisplay.openBBPort(Compiled Code)
103 at SerialPortDisplay.<init>(Compiled Code)
104 at BlackBox.addPort(Compiled Code)
105 at BlackBox.main(Compiled Code)
106
107 "1.1 compilers sometimes generate code that won't verify under 1.2.
108
109 If you don't have the sources for the offending class to recompile with
110 a 1.2 javac, the only solution I know of is to launch the VM with the
111 -noverify option.
112
113 Louis"
114
115 In other words start with a fresh build directory, rebuild, and
116 reinstall to avoid the problem.
117
118 [...]
119
120 L. Problems with RMISecurityManager()
121
122 Please see the file RMISecurityManager.html
123
124 M. Which Wires Should be Connected?
125
126 With the DB25 use 2 (TX), 3 (RX) and 7 (GD) to connect to the device.
127 With the DB9 use 2 (RX), 3 (TX) and 5 (GD) to connect to the device.
128
129 You will need to hook up more than that for hardware flow control.
130
131 N. Which Device Should be Used?
132
133 Linux serial ports should use /dev/ttyS?
134 specialx, cyclades and isdn4 linux have been reported to work.
135 as many as 64 ports have worked at one time.
136 FreeBSD uses cuaa?
137 netbsd uses tty0?
138 Irix uses ttyd? ttym? ttyf?
139 HP-UX uses tty0p? tty1p?
140 BeOS uses /dev/ports/serial?
141 Win32 uses COM?
142
143 [...]
144
145 P. Which jdk should be used?
146
147 Ideally any jdk would be fine. Here is a list of jdk's tried on
148 RedHat 6.0/kernel 2.2.17pre13 with various versions of glibc.
149
150 Sun IBM Blackdown
151 2.1.2_006 1.3.0 1.1.8v1
152 green native green native green native
153 ------------------------------------------
154 glibc-2.1.1-6 | OK | *1 | *2 | *2 | OK | *3 |
155 -------------------------------------------
156 glibc-2.1.2-11 | OK | *1 | OK | OK | OK | OK |
157 -------------------------------------------
158 glibc-2.1.2-17 | OK | *1 | OK | OK | OK | OK |
159 -------------------------------------------
160 glibc-2.1.3-15 | OK | *1 | OK | OK | OK | OK |
161 -------------------------------------------
162
163 1) BlackBox (a demo application shipped with CommAPI locks after multiple
164 open()/close()
165
166 2) java won't start "Unable to load /usr/local/java/jre/bin/libhpi.so: symbol
167 sem_wait, version GLIBC_2.1 not defined in file libpthread.so.0 with link time
168 reference Could not create the Java virtual machine."
169
170 3) java won't start "error in loading shared libraries:
171 /usr/local/java/bin/../lib/i686/native_threads/libjava.so: symbol sem_init,
172 version GLIBC_2.1 not defined in file libpthread.so.0 with link time reference"
173
174 Conclusion? Avoid Sun's native threads unless you can figure out whats going
175 wrong.
176
177 Q. How does rxtx detect ports? Can I override it?
178
179 rxtx tries to detect ports on by scanning /dev for files matching any
180 of a set of known-good prefixes, such as 'ttyS', 'ttym', and so on.
181 Any ones that exist, are supposed to be good for the current operating
182 system, and that can be read and written are offered back from
183 CommPortIdentifier.getPortIdentifiers(), and only these can be used as
184 ports.
185
186 If you wish, you can set the system properties gnu.io.rxtx.SerialPorts
187 and gnu.io.rxtx.ParallelPorts. If either of these is set, then no
188 scanning will be carried out and only the specified ports will be
189 available. You can use this to make one platform look like another,
190 to restrict Java access to ports, or possibly for other reasons. For
191 example
192
193 java -Dgnu.io.rxtx.SerialPorts=/dev/cua/a:/dev/cua/b com.foo.MyApp
194
195 will look kind of like Solaris, if you have created the appropriate
196 device nodes.
197
198 A note on Linux port enumeration. We have set most ports aside. Once the
199 number of possible devices started getting into the thousands, checking them
200 all made little sense. Look in RXTXCommDriver.java and search for Linux.
201
202 You will see that only /dev/ttyS* is searched but the possible addition ports
203 that can be used are listed under it. Just copy the few you need.
204
205 [...]
206
207 S. How can I tell which version of rxtx is installed?
208
209 Version information is not documented in Sun's CommAPI so this is probably
210 unique to RXTX.
211
212 As of rxtx-1.5-4 and rxtx-1.4-6 a class has been added to allow developers to
213 check which version of rxtx is installed. The class is RXTXVersion.
214
215 The static method: System.out.println(RXTXVersion.getVersion());
216
217 will print the rxtx version as a String in the following format:
218
219 "RXTX-MAJOR.MINOR-PATCH".
220
221 an example would be:
222
223 "RXTX-1.5-4"
224
225 A change in the MAJOR version would suggest you're in trouble.
226
227 Odd MINOR version are reserved for development. Even MINOR versions are
228 reserved for 'stable' releases.
229
230 PATCH is used to differentiate incremental releases of the MINOR releases.
231
232 CommPortIdentifier is expected to support getVersion() in the RXTX-1.5 series.
233
234 T. What Type of Latency can I expect with RXTX
235
236 frantz <[email protected]> put RXTX under a scope and found
237 the following:
238
239 RXTX currently has a latency of 150-200ms on a PII at 450mhz.
240 The latency can be reduced to 70-80ms by reducing the usleep()
241 value in SerialImp.c:eventLoop() to usleep(5000)).
242
243 Much lower latencies should be possible but the maintainer does not
244 have equipment to test changes.
245
246 He is going to look at this further. He needs 20 ms or less latency.
247
248 U. I got rxtx working on a new OS but I can't read from the port
249
250 > Now my java program starts up nicely without complaining. However, it does
251 > never read any data from the serial port. It looks like it can write data,
252 > because if I start a terminal program after I tried to run my program, I get
253 > all the return stuff from the modem that my program wrote.
254 >
255 > I hacked around abit and found out that it hangs in the select() call which
256 > simply never returns.
257 >
258 On Sun, 28 Jan 2001, Baldur Norddahl wrote:
259 > HPUX 11:
260 >
261 > As I wrote to the mailinglist I had some weird problems where it apparently
262 > could write data to the modem, but not read anything back. My terminal
263 > programs had no problem using the port. A few days after I reported the
264 > problem to the mailinglist, I had given up for now, but then I noticed that
265 > it suddenly worked! So it remains a mystery what was wrong as I did not
266 > change anything at all, neither in my program nor on the host.
267 >
268 > Baldur
269 >
270
271 I suspect two java applications had the port open. Its easy to do while
272 developing. Perhaps <ctl> z instead of <ctl> c was entered.
273
274 This is the reason for adding lockfile support to rxtx. If another application
275 has opened the port, a second application will appear to not be able to
276 read or get only part of the data. ..because the first one is reading. Only
277 one of the select()s are waken.
278
279 Its possible to put lockfile support in for HPUX if it is known where other
280 applications place their lockfiles. The easiest way to find out where is
281 to fire up minicom, kermit, ... and see where its lockfile is placed.
282
283 Here are the known suspects:
284
285 const char *lockdirs[]={ "/etc/locks", "/usr/spool/kermit",
286 "/usr/spool/locks", "/usr/spool/uucp", "/usr/spool/uucp/",
287 "/usr/spool/uucp/LCK", "/var/lock", "/var/lock/modem",
288 "/var/spool/lock", "/var/spool/locks", "/var/spool/uucp",NULL
289 };
290
291 freebsd uses /var/spool/uucp/, linux uses /var/lock those are the only two
292 I've done so far. Adding the support is trivial once a directory is
293 decided upon.
294
295 Lockfiles are rather simple. when an application opens a port it first checks
296 if there is a file with the ports name. If there is it grabs the PID from the
297 file. If that PID is still active the application does not open the port.
298
299 If the PID is not active or there is no lockfile, the application creates one
300 with its own PID in it.
301
302 The confusion starts when you have to decide where (see above) to put the
303 lockfile, what the name format is for the file and how to store the PID.
304
305 rxtx follows The File System Hierarchy Standard http://www.pathname.com/fhs/
306 on linux. I'm not positive what is normal on other OS's.
307
308 more reading:
309
310 The File System Hierarchy Standard
311 http://www.pathname.com/fhs/
312
313 FSSTND
314 ftp://tsx-11.mit.edu/pub/linux/docs/linux-standards/fsstnd/
315
316 Proposed Changes to the File System Hierarchy Standard
317 ftp://scicom.alphacdc.com/pub/linux/devlock-0.X.tgz
318
319 "UNIX Network Programming", W. Richard Stevens,
320 Prentice-Hall, 1990, pages 96-101.
321 more reading:
322
323 V. My ThinkPad is Not Working!
324
325 Scott Burleigh <[email protected]> writes:
326
327 For your files, and in case anybody asks in the
328 future, IBM Thinkpads ship with the external serial port
329 *disabled* by default. The Thinkpad configuration utility
330 supplied with the machine (under Windows) says it's enabled,
331 and the device manager in the System dialog of the Control
332 panel says it's enabled, but they lie. In order to enable the
333 port you have to use the old DOS ps2.exe bios configuration
334 utility which, under Windows 2000, is in
335 c:\Program Files\Thinkpad\utilities:
336
337 ps2 sera enable
338
339 Until you do, "setserial -ga /dev/ttyS0" will always tell you
340 the UART is unknown.
341
342 4. APPLETS
343
344 More info is needed on signing applets. This is an exchange from the rxtx mail-
345 list.
346
347 A. Using Applets
348
349 [email protected] asked:
350
351 Hi All !
352
353 I am trying to use applet on thin terminal which has
354 Linux base Kernel.For testing I am using Linux
355 machine.I have install all the required components.
356 e.g. JDK, RXTX. Everything is fine. BlackBox runs ,even
357 my application runs. When It comes to applet,
358 everything is halts. It does not even show the listing
359 of ports. Is it because applet can't run under root
360 account or what might be the reasons. Can anybody tell
361 me solution.
362
363 Son To <[email protected]> replied:
364
365 Java applets run within the sandbox of the security manager.
366 Applets must be signed to access the com port, but for development
367 purposes you can put
368
369 user_pref("signed.applets.codebase_principal_support", true);
370
371 in your prefs.js located in ~/.mozilla/default/XYYrandomDirName
372
373 I didn't use Java applet for my application. I used XUL and CSS for
374 the GUI development and used mozilla Javascript SOAP library to
375 communicate with apache Axis webservice backend which uses RXTX to
376 access the com port.
377
378 -------------------------------------------------------------------------------
379
380 --
381 Mario Jou/3en <[email protected]>