USB connection problem with Linux

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

USB connection problem with Linux

Postby epascual » Sun Aug 21, 2011 2:01 pm

Hello,

I just updated LeJOS to 0.9.0, and had no problem to flash the NXT with the new firmware (nice graphic menu ;)).

However, when trying to upload compiled programs (at the end of ant builds for example), the following error is displayed when attempting to do it via the USB link :
[java] leJOS NXJ> Error: Failed to load USB comms driver.
[java] leJOS NXJ> Caused by lejos.pc.comm.NXTCommException: Cannot load NXTComm driver
[java] leJOS NXJ> at lejos.pc.comm.NXTCommFactory.newNXTCommInstance(NXTCommFactory.java:96)
[java] leJOS NXJ> Caused by lejos.internal.jni.JNIException: library libjfantom.so (linux/x86) was not found in /home/eric/eclipse-workspaces/lejos-svn/trunk/snapshot/lib/pc/native
[java] leJOS NXJ> at lejos.internal.jni.JNILoader.loadLibrary(JNILoader.java:117)

I could not find libjfantom.so anywhere on my system and all Googlings semme to relate libjfantom to MacOSX (allways speaking about libjfantom.dylib).

Upload works fine via Bluetooth, but it's significantly slower :?

Could anybody shed some light please ?

Thanks in advance.
Eric PASCUAL - POBOT association VP & co-founder - http://www.pobot.org
epascual
Active User
 
Posts: 123
Joined: Sun Jan 17, 2010 12:15 am
Location: Sophia-Antipolis (France)

Re: USB connection problem with Linux

Postby skoehler » Tue Aug 23, 2011 1:03 pm

In your ant build, <jvmarg value="-Dnxj.home=${nxj.home}" /> is missing when NXJUpload is invoked. Hence, the nxj.properties file is not found which tells the classes to load the Fantom driver based pccomms, which is actually for windows only.

I guess, nxjupload is working fine, and only the ant build is broken?
skoehler
leJOS Team Member
 
Posts: 1401
Joined: Thu Oct 30, 2008 4:54 pm

Re: USB connection problem with Linux

Postby epascual » Wed Aug 24, 2011 7:34 am

Thanks skoehler for your quick reply.

I don't think this was the reason since the error occured while I was checking the new install by compiling and running some of the samples included in the distribution. Their build.xml are correct (of course :)) and include the option you mentionned.

Maybe it was a Gremlins hidden somewhere, since the last try I made after reading your post worked. The only difference from previous attempts is that I unpluged the BT dongle before, and the PC has been turned off while not using it (energy saving ;)).

I'm going now to remove the dust accumulated on my projects and update them to conform the new organisation of libs.

Best regards and thanks for your support.
Eric PASCUAL - POBOT association VP & co-founder - http://www.pobot.org
epascual
Active User
 
Posts: 123
Joined: Sun Jan 17, 2010 12:15 am
Location: Sophia-Antipolis (France)

Re: USB connection problem with Linux

Postby skoehler » Wed Aug 24, 2011 8:49 am

I've got news: we don't ship the nxj.properties file in the bin folder anymore. However, somehow leJOS must have though that it is running OS X or Windows, since those are the platforms for which leJOS tries to use the fantom driver. On Linux, it should use jlibnxt which is a JNI wrapper for libusb-based access.
skoehler
leJOS Team Member
 
Posts: 1401
Joined: Thu Oct 30, 2008 4:54 pm

Re: USB connection problem with Linux

Postby epascual » Wed Aug 24, 2011 9:08 am

I was suspecting this OS related point, since as far as I knew, fantom was not for Linux. It seems that the right OS is detected now.

With respect to jlibnxt I'd put it (in fact a symbolic link to the one in lib/pc/native/linux/x86) in the lejos_home/bin folder after having run the related build to generate it. Before doing so, an other error was reported, pointing the missing lib.

I take the opportunity to ask some question about the sample build provided in the sample projects. The section :
<condition property="d32Flag" value="-d32" else="-Dblank.dummy.arg=">
<and>
<os family="mac" />
</and>
</condition>

seems to set the d32Flag depending on if MacOS being detected or not Since I'm working for Linux only, I was wandering if I can simply remove all the usages of d32Flag in the rest of the build. I've noted that in case the build is not executed on MacOS, this property is set to "-Dblank.dummy.arg=" and adds the corresponding define as JVM argument. Is this required, or can I just remove all jvmarg tags referencing d32Flag ? I'm not an Ant wizard (far from it), but why is it needed to define this "else" clause, and why isn't it just omitted, since d32flag will then just be unset ? Maybe the resulting jmvarg would be invalid in this case ?
Eric PASCUAL - POBOT association VP & co-founder - http://www.pobot.org
epascual
Active User
 
Posts: 123
Joined: Sun Jan 17, 2010 12:15 am
Location: Sophia-Antipolis (France)

Re: USB connection problem with Linux

Postby skoehler » Wed Aug 24, 2011 9:28 am

epascual wrote:With respect to jlibnxt I'd put it (in fact a symbolic link to the one in lib/pc/native/linux/x86) in the lejos_home/bin folder after having run the related build to generate it. Before doing so, an other error was reported, pointing the missing lib.


You should not create that symbolic link. The native library is supposed to be loaded from lib/pc/native/linux/x86. It has been loaded form lejos_home/bin in former versions of leJOS. Do you have mixed an old version of leJOS with a new one? There should be no JAR files in lejos_home/lib - only int the subfolders lib/pc and lib/nxt - and the native library should be loaded successfully from lib/pc/native/linux/x86. I'd like to see the error message if leJOS doesn't work for you without that symlink you created.

epascual wrote:I take the opportunity to ask some question about the sample build provided in the sample projects. The section :
<condition property="d32Flag" value="-d32" else="-Dblank.dummy.arg=">
<and>
<os family="mac" />
</and>
</condition>

seems to set the d32Flag depending on if MacOS being detected or not Since I'm working for Linux only, I was wandering if I can simply remove all the usages of d32Flag in the rest of the build. I've noted that in case the build is not executed on MacOS, this property is set to "-Dblank.dummy.arg=" and adds the corresponding define as JVM argument. Is this required, or can I just remove all jvmarg tags referencing d32Flag ? I'm not an Ant wizard (far from it), but why is it needed to define this "else" clause, and why isn't it just omitted, since d32flag will then just be unset ? Maybe the resulting jmvarg would be invalid in this case ?


You can't omit an argument in ant. The else-case is to workaround the pure architecture of ant. If we wouldn't use "-Dblank.dummy.arg=", then the java command would see and empty argument "" which will cause trouble.

However, for Linux, you can safely remove all -d32 related stuff.
skoehler
leJOS Team Member
 
Posts: 1401
Joined: Thu Oct 30, 2008 4:54 pm

Re: USB connection problem with Linux

Postby melicaraballo » Wed Jun 20, 2012 7:36 pm

I am going through several problems installing Lejos on Linux...
I have tried with Lejos 0.9.1 and 0.8.5 and openjdk 6, the problems is that when i connect the NXT and tried to flash firmware an error comes out at 96% advising that there is no nxt connected. This happens to me with 2 different computers so I have to be doing something grong...

Any ideas?
melicaraballo
New User
 
Posts: 1
Joined: Wed Jun 20, 2012 7:27 pm

Re: USB connection problem with Linux

Postby skoehler » Wed Jun 20, 2012 7:39 pm

Can you manually put the NXT in firmware update mode (it is clicking) and connect it to USB. Then please post the output of nxjflash. Please use leJOS 0.9.1 since older version have problems with recent Linux kernels.
skoehler
leJOS Team Member
 
Posts: 1401
Joined: Thu Oct 30, 2008 4:54 pm


Return to NXJ Software

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests

more stuff