Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Multiple LabJacks


  • Please log in to reply
9 replies to this topic

#1 Guest_Dave Hurley_*

Guest_Dave Hurley_*
  • Guests

Posted 25 January 2006 - 05:57 PM

I need to have two or three LabJacks connected simultaneously, but when I test either the Xcode or AppleScript example code they report only one or the other of two connected labJacks. LabJackJava, on the other hand, sees both, but only if run from the command line. Can anybody shed light on this behavior and suggest things I might try to fix it? Thank you very much. Dave Hurley Manager of Departmental Computing Biology Department University of Washington

#2 CMReigrut

CMReigrut
  • Members
  • 163 posts

Posted 25 January 2006 - 08:11 PM

"LabJackJava, on the other hand, sees both, but only if run from the command line." I'm not sure what you mean on that one. Is there some other way that you run LabJackJava that doesn't recognize all of your LabJacks?

#3 Bytewraith

Bytewraith
  • Members
  • 40 posts

Posted 25 January 2006 - 08:28 PM

Should work. Make sure both are showing up in System Profiler. Run the script list LabJacks to see what's connected. Dave

#4 Guest_Dave Hurley_*

Guest_Dave Hurley_*
  • Guests

Posted 26 January 2006 - 11:20 AM

In answer to both questions: If I double-click labjack.jar it launches successfully and I see its monitor window - empty, though. If I launch labjack.jar from the command line, the same monitor window opens, populated with the appropriate number of labjacks. Similarly, if I run "list labjacks" from inside Script Editor or Script Debugger, it returns the serial number and zero for one labjack or nothing if two are connected. If I run the "osascript ljcheck.scpt" from the command line (which contains the 'list labjacks' applescript command) it returns the serial number and zero for any one connected labjack, but with two connected labjacks it returns: LabJack[1064]: LabJack - (Open) Could not USBInterfaceOpen: 0xE00002C5. LabJack[1064]: LabJack - Make sure LabJackNoHID.kext is in /System/Library/Extensions I've reinstalled the kext and osax. Twice. Both labjacks do appear in the System Profiler, but local IDs and serial numbers don't appear so I can't tell if the system is actually distinguishing between the two (if it needs to?). I've also tried plugging them into two different hubs and two different usb ports on the computer itself. No difference. Thanks for your help. Dave

#5 CMReigrut

CMReigrut
  • Members
  • 163 posts

Posted 26 January 2006 - 12:54 PM

Dave, When you run LJJ from the command line, are you doing the "setenv DYLD_LIBRARY_PATH ." there as well, or do you have it set globally? If the former, then that's the behaviour I'd expect, as it can't find the library when you double click the icon--you would see an error message to that effect, too, but since it's not showing you the console output, you don't. If you set the library path globally you should be able to double click the jar.

#6 Guest_Dave Hurley_*

Guest_Dave Hurley_*
  • Guests

Posted 27 January 2006 - 02:44 PM

Yes, I did do the setenv but I'll try again. Thanks for the suggestion. Dave

#7 [email protected]

[email protected]
  • Members
  • 6 posts

Posted 27 January 2006 - 11:35 PM

I have gotten the same error as you have but the conditions are : 1 labjack Either Apple's Script Editor or LNS Script Debugger is open and has run a script accessing the labjack. Once I closed the script editor my script (saved as an application) would run. It looks like the labjack code can't handle two programs active that have accessed a labjack. I don't know if this is the same or similar situation as you're experiencing, but the error we are getting is the same, so I suspect there's something wrong in the labjack code that doesn't handle the open/close correctly. If I remember correctly, I saw a comment somewhere else on this forum about someone making the accessing faster by caching the "Open" so it didn't have to open the labjack between every command. Perhaps there's an error in this code. I have also see a crash deep down in the labjack open code on the list labjacks command, so there may be additional things wrong. I have recently added support of the SHX temp/humidity sensor to the scripting addition (OSAX) so can use the labjack with Indigo for home automation. I have seen the error and/or the crash a few times while trying to use it. When I get some time, I'll look into this issue, but it make take a while before I can get to it. I believe that there may also be a case like the following. running an app that uses labjack. that app crashes now the app won't run the labjack again and crashes every time. restart the machine and the app runs again. This seems to indicate that the driver is not getting cleaned up and the crash disables any other app from accessing the labjack. I'm not sure of this because I seem to still be able to run the script under the script debugger but not as an application. Not sure what is happening here, but will try to find out and will let the forum know. Jerry

#8 Bytewraith

Bytewraith
  • Members
  • 40 posts

Posted 28 January 2006 - 12:12 AM

It's a USB device that's opened exclusive (well, do you really want two apps sending different commands to it? Some calls result in several USB requests, which need to be atomic if you allow multiple access, so it would be REALLY hard to make the driver multi-tasking reentrant). The code opens all of the LabJacks it can find. Once they're open another app can't access them. As you found out, for performance reasons they are opened and never closed until the very end. There isn't a driver, it's all userland USB calls. But if you open up the pipe, then lose the handles because you crashed, you're hosed. However, you can usually (actually always, I think) recover by unplugging and replugging. Dave

#9 [email protected]

[email protected]
  • Members
  • 6 posts

Posted 28 January 2006 - 11:08 AM

I made changes as recommended by "Bytewraith" above and it seems to fix the problem I was having. I have no way to test to see if it has an effect on multiple LabJacks, but I have attached the fixed code so perhaps Dave can try it. The labjack scripting addition as well as all the sources and Xcode project are in the attached file. If you are using the C code interface, the ljackmacx.c and .h files are in the archive. I have included the kext in this archive as well. Hopefully this will help. Jerry

Attached Files



#10 Guest_Dave Hurley_*

Guest_Dave Hurley_*
  • Guests

Posted 30 January 2006 - 03:03 PM

Thank you both for your suggestions and Jerry for your osax. Unfortunately I still see the same error and then only one LabJack serial number: 1 LabJack connected: $ osascript -e 'list labjacks' 100027595, 0 2 LabJacks connected: $ osascript -e 'list labjacks' LabJack[359]: LabJack - (Open) Could not USBInterfaceOpen: 0xE00002C5. LabJack[359]: LabJack - Make sure LabJackNoHID.kext is in /System/Library/Extensions 100027650, 0 So for the time being I'll see if I can make LabJackJava or perl scripts do what I need. Cheers, Dave


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users