Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Nov 2015 09:31:12 +0100
From:      Hans Petter Selasky <hps@selasky.org>
To:        Callum Aitchison <callum@aitchison.org>, freebsd-usb@freebsd.org
Subject:   Re: usbfs (usbdevfs) in Linux Emulation
Message-ID:  <564059D0.8000400@selasky.org>
In-Reply-To: <7558FEE0-F0EF-440B-98C2-9EE428C352E1@aitchison.org>
References:  <7558FEE0-F0EF-440B-98C2-9EE428C352E1@aitchison.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 11/08/15 17:14, Callum Aitchison wrote:
> Hi,
> I posted on the forum about this issue and was directed here as a better place to ask.
>
> My question is about usbfs (AKA usbdevfs) emulation within Linux compatibility - it doesn’t get created in the Linuxulator but some binary Linux software (Altera Quartus) I’m using requires it instead of libusb.
>
> The system is documented here: https://www.kernel.org/doc/Documentation/usb/proc_usb_info.txt
>
> I have tried unmounting linprocfs and creating my own /compat/linux/proc directory with bus/usb/devices copied from a Linux machine for the USB device listed and then the device location in bus/usb/002/007 symlinked to the FreeBSD USB device in /dev/ugen0.2. This, unsurprisingly, didn’t work since the Linux nodes are obviously different from the FreeBSD nodes. Worth a try.
>
> When I tried that dmesg printed the errors:
> linux: pid 4640 (jtagd): ioctl fd=6, cmd=0x550f ('U',15) is not implemented
> linux: pid 4640 (jtagd): ioctl fd=6, cmd=0x5510 ('U',16) is not implemented
>
> Looking these up in the Linux headers in linux/usbdevice_fs.h I found:
> #define USBDEVFS_CLAIMINTERFACE    _IOR('U', 15, unsigned int)
> #define USBDEVFS_RELEASEINTERFACE  _IOR('U', 16, unsigned int)
>
> Obviously the software was trying to claim and then release the USB interface but the ioctl must differ between FreeBSD and Linux so it doesn’t work, makes sense.
>
> Unfortunately I don’t understand the FreeBSD or Linux USB systems enough to work out a solution myself but I hope that there is either a pre-existing solution or a solution that could be worked out.
> I thought perhaps a translation layer between the Linux /proc/bus/usb/ and FreeBSD /dev/ugen* but have no idea where to start implementing that myself.
>
> Hopefully it can be sorted, it’d be nice to have all the USB stuff working in Linux emulation, especially to be able to do my FPGA development entirely in FreeBSD.
>

Hi,

The FreeBSD's /dev/ugenX.Y don't support Linux's USBFS. It might be you 
can build Linux's USBFS support into /usr/ports/multimedia/webcamd, 
which already emulate the Linux USB stack in user-space.

Latest version of webcamd from SVN:

http://www.selasky.org/hans_petter/video4bsd

--HPS




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?564059D0.8000400>