From owner-freebsd-usb@freebsd.org Sun Nov 8 16:14:44 2015 Return-Path: Delivered-To: freebsd-usb@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6771A29131 for ; Sun, 8 Nov 2015 16:14:44 +0000 (UTC) (envelope-from callum@aitchison.org) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40D291BBD for ; Sun, 8 Nov 2015 16:14:44 +0000 (UTC) (envelope-from callum@aitchison.org) Received: by wmnn186 with SMTP id n186so79606344wmn.1 for ; Sun, 08 Nov 2015 08:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aitchison_org.20150623.gappssmtp.com; s=20150623; h=from:content-type:subject:message-id:date:to:mime-version; bh=WLxuzZSD9OfSquv5wFKGV1qgfmkRXNlufdPRqjxILRw=; b=zLQm/gpkyVLhY3Y+JkR0qD71wiF9wxUei2aQFQBUT6WiueZIXzFexa884sDZLDbLl5 bCkGMphVzwK5QZBI57aaRQ9Zz506KJgWg3908LummjSpArEJuMiIPCxa/MUnNRd/zC9h 7KIMS+JC23APlaA7yDnf49nTYjmrRKsITRb/ViMstgReuU/TB/WoXjrwAjQpu5I+SKwz Th6+PDCN1jKuCRAqe4WNiblaURkTARO+GZdXeSHCqd+tmaG3Va1nqRXMTxQpRoSfxyLS qSXA/jlBYIL5q56LctsaznxWpPlRenJbncVD4qdgbA2bmGA9Rwg+IoU+YoEapKx5oiyz SpAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:subject:message-id:date:to :mime-version; bh=WLxuzZSD9OfSquv5wFKGV1qgfmkRXNlufdPRqjxILRw=; b=QnnCAiuhHf59mDe5PQ4/QsGih9LDs2HdVz37awsWi+25Ssl2UyP9DujnU4jbWWIyZ6 WyRsG7UB4YK/AuRPp1UB+Q0YlZuTEk2QEjPzOy8gowaUtrrR9Gz4uZEfhpTGsaq3nRd3 AxErgHIMFRRtPsB5t11pbI/h7Jy6Owl39MEh4Cq/rD9dt12UEw+RhnZ/mj+SF3QIOocw 0ZYEjJvWxcoJJBX++gEUteZNEC+jsf/Ob0WPv2uyKaVupeJu6JRR6k8VDGunFvVXCrlm N4KJnqMsqnYF+eI6DMNOiIK9rQeKtNRaNaX/NfF+ckvYs4UG4B5Ix7ElxvCO4ID3HNtW X/7Q== X-Gm-Message-State: ALoCoQkNEp1veROUfe4CSrWy1prug3TdYRZBAfAJ7XDDDoOcfFSMs75wTfBUmYdbOf8iYIWur+dP X-Received: by 10.28.135.206 with SMTP id j197mr22771432wmd.14.1446999282554; Sun, 08 Nov 2015 08:14:42 -0800 (PST) Received: from ?IPv6:2001:470:6d0e::2:a949? ([2001:470:6d0e::2:a949]) by smtp.gmail.com with ESMTPSA id e9sm10638862wjw.8.2015.11.08.08.14.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 08 Nov 2015 08:14:41 -0800 (PST) From: Callum Aitchison Subject: usbfs (usbdevfs) in Linux Emulation Message-Id: <7558FEE0-F0EF-440B-98C2-9EE428C352E1@aitchison.org> Date: Sun, 8 Nov 2015 16:14:39 +0000 To: freebsd-usb@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\)) X-Mailer: Apple Mail (2.3096.5) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2015 16:14:44 -0000 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=E2=80=99t get created in the Linuxulator but = some binary Linux software (Altera Quartus) I=E2=80=99m 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=E2=80=99t 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=3D6, cmd=3D0x550f ('U',15) is not = implemented linux: pid 4640 (jtagd): ioctl fd=3D6, cmd=3D0x5510 ('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=E2=80=99t work, makes sense. Unfortunately I don=E2=80=99t 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=E2=80=99d be nice to have all the USB = stuff working in Linux emulation, especially to be able to do my FPGA = development entirely in FreeBSD. Thanks in advance. Callum=