我已经熟悉Tiny OS的环境,目前我在第4课“ Mote-PC串行通信和SerialForwarder”上 我被困在必须侦听串行端口中任何传入数据的部分。我正在尝试实现一个简单的示例,在该示例中,我需要使用TestSerial脚本来侦听任何传入的消息,但是在运行时
java TestSerial -comm serial@/dev/ttyUSB0:iris
我的输出如下:
Error loading the TinyOS JNI libraries the conventional way!
Attempting to load library 'toscomm'
Could not load library 'toscomm': no toscomm in java.library.path
----------
java.lang.UnsatisfiedLinkError: no toscomm in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at net.tinyos.util.TOSLibraryLoader.load(TOSLibraryLoader.java:85)
at net.tinyos.comm.TOSCommJNI.<clinit>(TOSCommJNI.java:14)
at net.tinyos.comm.NativeSerial.getTOSCommMap(NativeSerial.java:207)
at net.tinyos.comm.TOSSerial.<init>(TOSSerial.java:277)
at net.tinyos.packet.SerialByteSource.openStreams(SerialByteSource.java:67)
at net.tinyos.packet.StreamByteSource.open(StreamByteSource.java:61)
at net.tinyos.packet.Packetizer.openSource(Packetizer.java:149)
at net.tinyos.packet.AbstractSource.open(AbstractSource.java:78)
at net.tinyos.packet.Packetizer.open(Packetizer.java:142)
at net.tinyos.packet.PhoenixSource.run(PhoenixSource.java:178)
----------
In order to load the library 'toscomm' Java tries to locate the file 'libtoscomm.so' in one of the following paths:
/usr/java/packages/lib/i386:/lib:/usr/lib
The operating system is 'Linux' (i386)
Trying to locate the file 'linux_x86_toscomm.lib' in the classpath
Temporary file created: '/tmp/toscomm3780740783398787473.lib'
Library copied successfully. Let's load it.
Library loaded successfully
serial@/dev/ttyUSB0:57600: resynchronising
Sending packet 0
Sending packet 1
代替
Sending packet 1
Received packet sequence number 4
Sending packet 2
Received packet sequence number 5
如教程中所述
我担心运行此脚本时会收到警告,尤其是这个
Attempting to load library 'toscomm'
Could not load library 'toscomm': no toscomm in java.library.path
根据教程,可以通过运行
解决此错误。sudo tos-install-jni,
但是,当我键入此命令时,会出现找不到tos命令的错误。
我尝试转到tinyos-2.x/tools/tinyos/java.
目录并键入sudo make
和sudo make install
,但是仍然无法正常工作,给我以下错误:
make[1]: Entering directory '/home/wsn/tinyos-main/tools'
/bin/sh ./config.status --recheck
running CONFIG_SHELL=/bin/sh /bin/sh ./configure --no-create --no-recursion
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for ranlib... ranlib
checking for a Python3 interpreter with version >= 3.0... python3
checking for python3... /bin/python3
checking for python3 version...
checking for python3 platform... linux
checking for python3 script directory... ${prefix}/lib/python3.4/site-packages
checking for python3 extension module directory... /lib/python/site-packages
checking for a Python interpreter with version >= 2.5... python2
checking for python2... /bin/python2
checking for python2 version... 2.7
checking for python2 platform... linux2
checking for python2 script directory... ${prefix}/lib/python2.7/site-packages
checking for python2 extension module directory... (cached) /lib/python/site-packages
checking for perl... /bin/perl
checking for python2... /bin/python2
checking for python3... /bin/python3
checking for python2.7-config... /bin/python2.7-config
checking for dot... no
configure: I can't find dot. dot is required for documentation.
checking for nescc... /bin/nescc
checking for cygwin... no
checking for JDK location... configure: error: java not found
Makefile:377: recipe for target 'config.status' failed
make[1]: *** [config.status] Error 1
make[1]: Leaving directory '/home/wsn/tinyos-main/tools'
Makefile:374: recipe for target '../../config.status' failed
make: *** [../../config.status] Error 2
当我尝试为BaseStation脚本运行相同的命令时,该程序会给出相同的警告,并在此时冻结:
serial@/dev/ttyUSB0:57600: resynchronising
所以我什至看不到任何发送或接收的数据包!
我不确定这是什么问题,请帮忙。
我在Fedora OS上使用虚拟机
我试图在mib520平台上运行该程序,并且使用虹膜微粒
我的Java版本
openjdk版本“ 1.8.0_31” OpenJDK运行时环境(内部版本1.8.0_31-b13) OpenJDK Server VM(内部版本25.31-b07,混合模式)
答案 0 :(得分:1)
我不认为您的问题与toscomm有关,只要库成功加载成功,您就不会遇到任何问题。每次使用串行接口时,我总是会遇到同样的异常情况,但是您并没有费心去修复它,因为它并没有真正妨碍串行端口的运行。
最后,我通过将libtoscomm
目录中的{TOS_ROOT}/tools/tinyos/java/serial/
复制到TinyOS正在查找库的目录之一来摆脱了异常。在您的情况下,您将目录libtoscomm
,/usr/java/packages/lib/i386
或/lib
之一中的/usr/lib
文件。
您可以尝试这样做,看看是否能为您解决异常问题。
我怀疑可能是导致您的问题的原因是您没有将TestSerialAppC加载到计算机上并连接到串行端口。您确定微粒已连接到串行端口吗?
我加载的是在远程运行该应用程序并获得以下输出,所以问题不在于TestSerialAppC
serial@/dev/tty.usbserial-FTYRYAHT:115200: resynchronising
Sending packet 0
Received packet sequence number 3
Sending packet 1
Received packet sequence number 4
Sending packet 2