Index
RSS

Welcome Guest [ Log In | Register ]

 
Reply to this topicStart new topic
> OS X 1.1 Users bits and source, Current Mac drivers for the U12
Bytewraith
post Aug 29 2004, 12:03 PM
Post #1

Joined: 29-June 03
Posts: 40




Here is:
An installer which will install a kext and a Scripting Addition.
Sample Scripts which use the scripting addition.
Source for a Mac OS X version of the LabJack library, scripting addition, and test code.

The code has been updated since 1.0.1. A few memory/resource leaks were fixed. It was updated to the latest library code. The installer is a lot prettier and asks for a reboot (it was too much effort to force it to load).

Dave
Attached File(s)
Attached File  LabJack.dmg.zip ( 234.01K ) Number of downloads: 1128
 
 
Quote Post
fuelcelldave
post Sep 14 2004, 01:35 PM
Post #2

Joined: 10-June 03
Posts: 71




Thanks, Dave, as always!

I was trying to use 2 LJs, one each from a separate application, using the 1.01 libraries, but only the first app launched could find its LJ. Hadn't gotten too detailed with trying to figure out why yet. Will try the 1.1 stuff and see how it goes.

Dave
 
Quote Post
fuelcelldave
post Sep 14 2004, 02:19 PM
Post #3

Joined: 10-June 03
Posts: 71




the 1.1 source still won't let me use 2 labjacks from two different apps at the same time.
 
Quote Post
Bytewraith
post Sep 14 2004, 05:21 PM
Post #4

Joined: 29-June 03
Posts: 40




To speed things up the first call to Open() opens all LabJacks and puts them in a table. I suppose it would be possible to make a temporary table of discovered units and a second table of units requested in the Open(). There will still be abritration issues, such as what if both applications ask for the "default" (first) unit? There wouldn't be an easy way for the two applications to say who has what open.

Dave
 
Quote Post
LabJack Support
post Oct 25 2005, 03:04 PM
Post #5

Joined: 9-June 03
Posts: 5498




This topic has been pinned by LabJack Support, as we believe these are the latest user-submitted Mac drivers for the U12.
 
Quote Post
pfossey
post Nov 27 2005, 11:52 AM
Post #6

Joined: 27-November 05
Posts: 2




Thank you for posting the Mac OS X code.
I am in the process of building a Mac OS X / Windows application that uses the
LabJack. The work you have done has saved me a lot of time.

I have build a simple test application that just asks for the LabJack firmware
version stamp.

The application crashes once in a while.
If I run the program 20 times, it will crash with a seg fault 1 or 2 times.

Before I start digging into the root cause, I was wondering if you are aware of
any problems with the interface code on the Mac.

I am testing on a G5 Dual 2.5 Ghz system running OS 10.3.9.


Thanks,
Paul
 
Quote Post
Bytewraith
post Nov 27 2005, 12:48 PM
Post #7

Joined: 29-June 03
Posts: 40




There is a problem where on a dual processor system the thread that sets up the notification can take longer than the main thread causing a failure. I have attached code that fixes the problem. Unfortunately, I don't have time to do a complete release package with installer.

Dave
Attached File(s)
Attached File  ljackmac_fix.zip ( 57.43K ) Number of downloads: 428
 
 
Quote Post
pfossey
post Nov 27 2005, 11:09 PM
Post #8

Joined: 27-November 05
Posts: 2




Thanks Dave.

The callback function: MyNotifyProc() does get called eventually in all cases.

I added the following code to the open function to address the issue:
(A semaphore would be better, but this trick works)

// NEW CODE
// Wait to make sure the callback function has been called so we
// have a valid gNotifyPort
int passCount;
for( passCount = 0; passCount < 3; ++passCount )
{
if( gNotifyPort != 0 )
break;
sleep(1);
}

// Now set up a notification to be called when a device is first matched by I/O Kit.
if (!gNotifyPort)
{
*errorcode = OPEN_HANDLE_ERROR_LJ;
return -1;
}

I ran ran my test program several hundred times, and never observed more than
a single call to the sleep(1) in the for( passCount ) loop.

Thanks for your help,
Paul
 
Quote Post
Bytewraith
post Nov 28 2005, 09:37 AM
Post #9

Joined: 29-June 03
Posts: 40




The code in the zip file I posted has the semiphore added.

Dave
 
Quote Post
David
post Nov 30 2005, 06:20 AM
Post #10

Joined: 22-May 05
Posts: 14




I have had similar crashing in same routine quite often and have ignored it for now. I have not tried the code posted but this crashing occurs on a new powerbook 1.67Mhz, which is a single processor machine..
 
Quote Post
klassen6g
post Jan 15 2008, 02:23 PM
Post #11

Joined: 26-August 03
Posts: 3




Is there any way I can get a fixed copy of the complete U12 drivers, with both the fix below and the one by Kris for Intel Macs:
Kris' Intel Mac Fix Thread

I've tried recompiling the source code but only have XCode version 2.5 and it doesn't seem to build anything I can use.

peace,
Grant

QUOTE (pfossey @ Nov 28 2005, 06:09 AM) *
Thanks Dave.

The callback function: MyNotifyProc() does get called eventually in all cases.

I added the following code to the open function to address the issue:
(A semaphore would be better, but this trick works)

// NEW CODE
// Wait to make sure the callback function has been called so we
// have a valid gNotifyPort
int passCount;
for( passCount = 0; passCount < 3; ++passCount )
{
if( gNotifyPort != 0 )
break;
sleep(1);
}

// Now set up a notification to be called when a device is first matched by I/O Kit.
if (!gNotifyPort)
{
*errorcode = OPEN_HANDLE_ERROR_LJ;
return -1;
}

I ran ran my test program several hundred times, and never observed more than
a single call to the sleep(1) in the for( passCount ) loop.

Thanks for your help,
Paul
 
Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
RSS