1-Wire on Mac OS X and Universal Binaries

Posted by Scott Hughes Fri, 17 Mar 2006 00:51:00 GMT

Since posting my OneWireViewer App+Source for Mac OS X last August, I still see fairly regular downloads of it in my stats. I also still see lots of hits from google searches for “1-wire” and “mac osx”. I thought I’d let any interested parties know that we are gearing up to release our 1-Wire Public Domain Kit (C code) very soon (likely this month). I put in some effort for this release to create a specific Serial (DS9097U) and USB (DS2490/DS9490) build for Mac OS X. The release will include full source and a build file, as well as pre-built Universal Binaries of all of the example apps. Those without much programming knowledge looking to integrate 1-Wire into bigger systems should appreciate that.

Learning how to build the Universal Binaries was a bit of a chore, but once you get the hang of it it’s fairly simple. The biggest complication was building a Universal Binary for libUSB and since I wanted my libUSB-dependent app to be Universal, I had to jump through hoops to get it to work. I was able to get 0.1.12 to build an Intel library just fine on my Intel Mac (though <= 0.1.11 didn’t work for me, so mind your sources). I couldn’t get it to build the Universal binary due to it’s use of ‘ar’ and ‘ranlib’ (which, according to this tech note from Apple does bad things to Universals). I’m not a configure or makefile whiz and I got a little stumped on the parts of the makefile where gcc was being used to generate new makefiles dynamically (wasn’t aware of this feature before). Apparently when using -MT (to generate new makefile rules) you can’t pass multiple architectures along with your compile command (i.e. “-arch i386 -arch ppc”). I ended up doing things the hard way and just compiling the PPC binary on a PPC mac, and then merging the two with lipo (i.e. “lipo -create -output uni.lib ppc.lib intel.lib”). After all that, I discovered a nice pkg installer for a Universal libUSB that someone else was nice enough to pre-build and distribute for us. I recommend this installer for the easiest path to a Universal binary of libUSB.

My next task is to recompile my Java-to-libUSB-to-1-Wire solution (for OneWireViewer and the rest of the examples in the 1-Wire API for Java) as a Universal Binary. I also need to put a little effort into making it work with libUSB on Linux, so I can update the “live” WebStart version of OneWireViewer with virtually out-of-the-box support for every platofrm. The 1-Wire API for Java was scheduled for release this quarter (ending in 2 weeks), so I hope to have all this done in time to ship out the door with the release.

Posted in ,  | Tags , ,  | 7 comments

Comments

  1. Avatar Greg Smith said 222 days later:

    So whats up with this? I’m looking for a driver for my DS2490 device.

  2. Avatar Don Shikoski said 365 days later:

    Being Mac Challenged and having just purchased the USB DS2490 for my Mac Mini… I’m looking for a set of install/configuration instructions for the combination of devices. Is there a good resource that will help me set this up? Thanks for all of your work on this project.

  3. Avatar Scott Runnion said 412 days later:

    I echo Greg’s and Don’s request and thanks for your efforts. Would love to help out in the testing phases. Can we get a status update?

  4. Avatar Don said 741 days later:

    How I got it to work:

    1) Download the libusb-0.1.12 from sourceforge and follow instructions to “Make” it http://downloads.sourceforge.net/libusb/libusb-0.1.12.tar.gz?modtime=1141419160&big_mirror=0

    I (or the installation) installed the file in the /usr/local/lib directory

    2) Download the PDKAdapterUSB from the next message and follow instructions to build it. http://globalreset.org/files/distribution/PDKAdapterUSB.tar.gz

    This gives you a “test” program and the test program should see your DS9490 device. This confirms that the program s built successfully. You should now have a libonewireUSB.jnilib file. This goes into the /Library/Java/Extensions folder.

    3) Download the 1-Wire API for Java source kit from maxim-ic.com http://files.dalsemi.com/auto_id/public/owapi_1_10.zip and find the OneWireAPIsrc.jar file.

    4) Extract the files into some directory and fix the OneWireAccessProvider.java file (see comments on next message).

    5) Add in the PDKAdaptorUSB.java (correcting the slight error with it from comments on next message).

    6) Build the jar file OneWireAPI.jar and place that also in /Library/Java/Extensions directory.

    7) Look at the examples directory from the API kit for the OneWireViewer. Build it and it should work.

    Since I used XCode to edit and build the java files, I had to comment out the loading of the graphic icons. This was due to my lack of knowledge on how to specify in XCode where to put files and could not get a “image” directory in the build. It appears that the “build.bat” file does not put the images in the jar file either, so be warned you might need to modify the code somewhat for the icons.

    Also, the OneWireViewer looks for the file “onewireviewer.properties” and if it does not find it, then it will try to write to the “system” directories and you will get an “permission denied” error on exiting. I found that placing the file in same directory as the OneWireViewer.jar file will fix that problem.

    Once you get past these minor glitches, the OneWireViewer works just like it does on the PC and I have not had any problems with it detecting my adding new 1-wire devices or removing them.

    My thanks to Scott for his work on the PDKAdapterUSB.

  5. Avatar baracudaz said 771 days later:

    Hi Scott,

    Thanks for your work I really appreciate it. I finally managed to get it working on Leopard. Which is great!!!

    Do you have any plans to release it officially? I strongly encourage it. It’s shame that Mac OS X / Linux users can not have same level of support from Maxim even though source codes are ready. Thanks again!!

  6. Avatar Heiko said 900 days later:

    @Don: I don’t really get step 5 – what fix? Could you put a diff online somewhere?

  7. Avatar Heiko said 901 days later:

    Ok, I think I got it and am currently writing a plugin for the Open Source monitoring solution “RHQ” : http://javablogs.com/Jump.action?id=455329

(leave url/email »)

   Comment Markup Help Preview comment