FreeBSD port

Supporting 2.6 and up
mgades

Solution

Postby mgades » Tue Aug 21, 2007 2:19 pm

YES! I finally found the error...

As even the test programs shipped with libusb all failed, it knew it must have had something to do with the underlying USB subsystem.
I configured a new kernel without uhid support built-in and now I get the following output from the examples/manger app:

Code: Select all

[root@lagavulin /home/mgs/phidget21.linux.2.1.2/phidget21/examples]# ./manager
Device Added: PhidgetInterfaceKit, Serial: 31245, Version: 823


I guess libusb wasn't able to access the device when it has already been claimed by the kernel HID driver.

The phidget21 is indeed platform independent!

Thanks!

Morten

User avatar
Patrick
Lead Developer
Posts: 3100
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Postby Patrick » Tue Aug 21, 2007 3:13 pm

Ah yes.. sorry that I didn't mention that. On linux, libusb provides a way to disconnect devices from the HID driver which doesn't exist for BSD. Also, the usb_cleanup() is a method that I added to libusb myself.. hence it not being there, though it's not really needed.

Congrats on getting it working though! It's good to know that it can be done, and perhaps I will include this in the main release.

-Patrick

Deklar

Freebsd 7.0 - Anyone try?

Postby Deklar » Mon Jul 28, 2008 6:59 pm

From the posts here it sounds like FreeBSD 6.x works. Can anyone verify that they are able to read sensors from an 8/8/8? Anyone have examples? I suspect that FreeBSD 7.0 should work as well if 6.x works.


UPDATE: After some modifications, I have FBSD 7.0 working great with Phidgets. Running a combination of X10 for electrical controls and dimmers, along with multiple analog phidgets, this project is taking some life.

Update: I'll get you the specifics in awhile. Basically we are using the cheapest equipment with some back-end coding and Phidgets/1-wire scanners. I find the "expensive"stuff is just the brains at the end of the outlets -- which really just complicates things. One box (or multiple, if you have a database server as I do) need to handle everything. I want the front door to "know" when the bathroom light is on, and to "know" the humidity in the basement.

If my house was really this clean, I'd put the extra time in to port this entire project to BSD...
Last edited by Deklar on Sun Jun 14, 2009 4:23 pm, edited 3 times in total.

vat23

Re: FreeBSD port

Postby vat23 » Mon Jun 01, 2009 1:52 pm

Care to post detailed instructions/a port?

Thanks.

berkinet
Phidget Mastermind
Posts: 155
Joined: Thu Sep 17, 2009 12:17 pm
Contact:

Re: FreeBSD port

Postby berkinet » Thu Dec 31, 2009 8:51 pm

I just tried building Phidgets21 on FreeBSD 8.0 following the instructions found above. Short summary: I got it installed, but, it didn't work.

To get Phidgets21 built I had to use libusb-0.1.12. In all other versions configure produced an unsupported operating system error. This whole part of the process could probably be avoided now since FreeBSD 8.0 includes libusb.

Once I got past libusb I ran into problems with lib dl:
cc -o manager manager.c -g -O0 -Wall -I../ -lphidget21 -lpthread -ldl
/usr/bin/ld: cannot find -ldl
.
Supposedly in FreeBSD the dlopen family of functions are in libc so I removed the reference in the Makefile, changing:
LIBS= -lphidget21 -lpthread -ldl
to
LIBS= -lphidget21 -lpthread
Note: This is probably the root of the problems.

After that I could successfully compile and install Phidgets21. Though the install process seemed to mess up the paths (usr/lib//... instead of /usr/lib/...). But, the null dir was ignored and everything showed up in the right places.

I also compiled a new kernel without uhid support.

But, when I connect my 1202 I get:
Dec 31 18:10:37 gw kernel: ugen0.6: <Phidgets Inc.> at usbus0
Dec 31 18:10:37 gw root: Unknown USB device: vendor 0x06c2 product 0x007d bus uhub0

Nothing appears in /dev
So, the integrated controller display is at least 1/2 recognized.

Finally, manager shows nothing when the controller is connected/disconnected.

So, even though I am probably close, and may still get this working, it is looks like changes in FreeBSD may make a port easier, but might also make it more necessary.

berkinet
Phidget Mastermind
Posts: 155
Joined: Thu Sep 17, 2009 12:17 pm
Contact:

Re: FreeBSD port

Postby berkinet » Tue Oct 26, 2010 11:11 am

Well, things have changed since the last time I tried to get the Phidgets web service running on FreeBSD (8.1-PRERELEASE). It now works.

Note: I had previously deleted uhid support from my kernel (see previous postings in this thread).

The key is to follow the instructions in the phidgetwebservice21 README. Specifically, the configure command line must be modified to:
./configure LIBS=/usr/lib/libphidget21.so CFLAGS=-pthread

I found that mDNSResponder would not announce the Phidgets, but switching to avahi (/usr/ports/net/avahi) solved that problem. I found a note from this page that gives a few good tips, especially:
    ...install avahi and nss-mdns. Please note that avahi requires dbus which, in turn, requires glib, so if you don’t have these packages installed already, it could take some time. Also, since nss-mdns requires avahi, all you have to do is install nss-mdns and it will grab everything else automatically.

Finally, I created an rc.d file to manage the web service daemon. Here is a copy:

Code: Select all

#!/bin/sh
#

# PROVIDE: Phidgets Web Service
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following line to /etc/rc.conf to enable phidgetwebservice21:
# phidgetwebservice21_enable="YES"

. /etc/rc.subr

name=phidgetwebservice21
rcvar=${name}_enable

command=/usr/bin/${name}
command_args="-v -n "Phidget Server" 2>&1 >/var/log/phidgetwebservice21.log &"

phidgetwebservice21_enable=${phidgetwebservice21_enable:-"NO"}

load_rc_config $name
run_rc_command "$1"

That's pretty much it.
Last edited by berkinet on Mon Nov 08, 2010 1:56 pm, edited 1 time in total.

User avatar
Patrick
Lead Developer
Posts: 3100
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: FreeBSD port

Postby Patrick » Tue Oct 26, 2010 11:35 am

The Phidgets library / webservice compile for avahi by default, but you should alse be able to use mDNSresponder by compiling for bonjour (bonjour == mDNSresponder):

Code: Select all

./configure --enable-zeroconf=bonjour

-Patrick

berkinet
Phidget Mastermind
Posts: 155
Joined: Thu Sep 17, 2009 12:17 pm
Contact:

Re: FreeBSD port

Postby berkinet » Tue Oct 26, 2010 2:26 pm

patrick wrote:...you should alse be able to use mDNSresponder by compiling for bonjour (bonjour == mDNSresponder)
You'd think... but, I could not get the web server to automatically register the Phidgets with mDNSResponder (I was actually using mDNSResponderPosix). Also, there is very little documentation/examples on mDNSResponderPosix. No doubt with enough effort I could have gotten it to work. But, since avahi is well known, and in ports, I just went with that.

cosmicboy

Re: FreeBSD port

Postby cosmicboy » Thu Apr 21, 2011 8:23 pm

Hi am new on the Phidgets ... and i am a freebsd user since 1994, just for the record the last post was in Oct 2010, there is a status about the port for FreeBSD 8.2? on amd64? or i386?, we are looking forward for a FreeBSD based solution controlling solenoids like this one:

http://www.goldmine-elec-products.com/p ... ber=G16822

using the:

http://www.phidgets.com/products.php?ca ... ct_id=3052

and the:

http://www.phidgets.com/products.php?product_id=1018

connected via USB.

Hope some one there knows about this, thanks in advance.

Eric De La Cruz Lugo.
Merida, Yucatan, Mexico.
FreeBSD rulez!

User avatar
Patrick
Lead Developer
Posts: 3100
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: FreeBSD port

Postby Patrick » Tue Apr 26, 2011 9:10 am

FreeBSD works - it is unofficially supported. Download the Linux source and read the readme, there is a section on FreeBSD.

-Patrick


Return to “Linux”

Who is online

Users browsing this forum: No registered users and 2 guests