From owner-svn-src-all@FreeBSD.ORG Mon Jan 18 22:46:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21738106566B; Mon, 18 Jan 2010 22:46:07 +0000 (UTC) (envelope-from wkoszek@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 070008FC1B; Mon, 18 Jan 2010 22:46:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0IMk6QR000349; Mon, 18 Jan 2010 22:46:06 GMT (envelope-from wkoszek@svn.freebsd.org) Received: (from wkoszek@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0IMk6dw000346; Mon, 18 Jan 2010 22:46:06 GMT (envelope-from wkoszek@svn.freebsd.org) Message-Id: <201001182246.o0IMk6dw000346@svn.freebsd.org> From: "Wojciech A. Koszek" Date: Mon, 18 Jan 2010 22:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202598 - head/sys/compat/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2010 22:46:07 -0000 Author: wkoszek Date: Mon Jan 18 22:46:06 2010 New Revision: 202598 URL: http://svn.freebsd.org/changeset/base/202598 Log: Let us to use our libusb(3) in Linuxolator. With this change, Linux binaries can work with our libusb(3) when it's compiled against our header files on GNU/Linux system -- this solves the problem with differences between /dev layouts. With ported libusb(3), I am able to use my USB JTAG cable with Linux binaries that support it. Reviewed by: thompsa Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Mon Jan 18 22:39:33 2010 (r202597) +++ head/sys/compat/linux/linux_ioctl.c Mon Jan 18 22:46:06 2010 (r202598) @@ -96,6 +96,7 @@ static linux_ioctl_function_t linux_ioct static linux_ioctl_function_t linux_ioctl_sg; static linux_ioctl_function_t linux_ioctl_v4l; static linux_ioctl_function_t linux_ioctl_special; +static linux_ioctl_function_t linux_ioctl_fbsd_usb; static struct linux_ioctl_handler cdrom_handler = { linux_ioctl_cdrom, LINUX_IOCTL_CDROM_MIN, LINUX_IOCTL_CDROM_MAX }; @@ -121,6 +122,8 @@ static struct linux_ioctl_handler sg_han { linux_ioctl_sg, LINUX_IOCTL_SG_MIN, LINUX_IOCTL_SG_MAX }; static struct linux_ioctl_handler video_handler = { linux_ioctl_v4l, LINUX_IOCTL_VIDEO_MIN, LINUX_IOCTL_VIDEO_MAX }; +static struct linux_ioctl_handler fbsd_usb = +{ linux_ioctl_fbsd_usb, LINUX_FBSD_USB_MIN, LINUX_FBSD_USB_MAX }; DATA_SET(linux_ioctl_handler_set, cdrom_handler); DATA_SET(linux_ioctl_handler_set, vfat_handler); @@ -134,6 +137,7 @@ DATA_SET(linux_ioctl_handler_set, privat DATA_SET(linux_ioctl_handler_set, drm_handler); DATA_SET(linux_ioctl_handler_set, sg_handler); DATA_SET(linux_ioctl_handler_set, video_handler); +DATA_SET(linux_ioctl_handler_set, fbsd_usb); struct handler_element { @@ -2960,6 +2964,24 @@ linux_ioctl_special(struct thread *td, s } /* + * Support for mounting our devfs under /compat/linux/dev and using + * our libusb(3) compiled on Linux to access it from within Linuxolator + * environment. + */ +static int +linux_ioctl_fbsd_usb(struct thread *td, struct linux_ioctl_args *args) +{ + + /* + * Because on GNU/Linux we build our libusb(3) with our header + * files and ioccom.h macros, ioctl() will contain our native + * command value. This means that we can basically redirect this + * call further. + */ + return (ioctl(td, (struct ioctl_args *)args)); +} + +/* * main ioctl syscall function */ Modified: head/sys/compat/linux/linux_ioctl.h ============================================================================== --- head/sys/compat/linux/linux_ioctl.h Mon Jan 18 22:39:33 2010 (r202597) +++ head/sys/compat/linux/linux_ioctl.h Mon Jan 18 22:46:06 2010 (r202598) @@ -611,4 +611,10 @@ int linux_ifname(struct ifnet *, char #define LINUX_IOCTL_VIDEO_MIN LINUX_VIDIOCGCAP #define LINUX_IOCTL_VIDEO_MAX LINUX_VIDIOCSVBIFMT +/* + * Keep in sync with our include/dev/usb/usb_ioctl.h. + */ +#define LINUX_FBSD_USB_MIN 0x5100 +#define LINUX_FBSD_USB_MAX 0x55c7 + #endif /* !_LINUX_IOCTL_H_ */