Porting op to FreeBSD
Matt Dawson
matt at chronos.org.uk
Wed Jul 20 08:59:50 UTC 2011
On Tuesday 19 July 2011 14:13:17 Hans Petter Selasky wrote:
> > http://sourceforge.net/projects/openprogrammer/files/OP/op_0.7.9.
> > tar.gz
> >
> > to FreeBSD and have run into a brick wall (my lack of knowledge,
> > basically). It uses Linux' hiddev to communicate with the
> > OpenProgrammer hardware, which isn't compatible with our usbhid.
> > The ioctls and structs are very different. The programmer itself
> > has a uhidX device node and seems to be fine under FreeBSD.
>
> There are many ways to achieve your goal. The simplest one might be
> to compile the Linux HID layer into the webcamd deamon and have a
> compatible interface. This means no porting effort.
Interesting, although it does introduce a dependency on webcamd which,
for an otherwise small program, seems a little mad.
> You will have to checkout and install the linux_make tool from the
> I4B SVN, referred to from the webcamd
> (/usr/ports/multimedia/webcamd) homepage:
>
> http://www.selasky.org/hans_petter/video4bsd/
>
> And add some config entries to the config file for the HID layer,
> and possibly also resolve a few compile issues.
I suspect this is going to be the main issue. It pulls in hiddev.h for
Linux directly and has no configure stage, so it expects those headers
to be where they should be on a vanilla Linux box. It does compile
under Windows/Cygwin with a conditional in the defines, so the
dependency on hiddev is obviously portable. I'd much rather make it
native and throw my changes back upstream. The whole point of this
device is that it's open so it needs to run everywhere and that little
CLI really is the bare bones.
I have been in contact with the developer and he thinks getting read()
and write() working is the main step and everything else is trivial.
It's just translating those ioctl calls and structs to our usbhid that
stumping me, simply because I don't understand what they do in either
OS. I have an idea that the ioctls are simply to pull in the packet
size for read and write operations but, beyond that, my clue chest is
empty.
I'll probably have to just bite the bullet, sit down and compare what
it does in both Linux and Windows/Cygwin and then try to work out how
to get the same results on FreeBSD. There's no being lazy, it seems!
--
Matt Dawson
MTD15-RIPE
matt at chronos.org.uk
More information about the freebsd-usb
mailing list