summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorwkoszek <wkoszek@FreeBSD.org>2010-01-18 22:46:06 +0000
committerwkoszek <wkoszek@FreeBSD.org>2010-01-18 22:46:06 +0000
commit260e3efd2e45228ab1445c7e7eade0f2679a538e (patch)
treecfb45762cc2327e706fdc29b7d4ab2b25f382286 /sys/compat
parent85555d355f49895dce2738102fdb839df8397d68 (diff)
downloadFreeBSD-src-260e3efd2e45228ab1445c7e7eade0f2679a538e.zip
FreeBSD-src-260e3efd2e45228ab1445c7e7eade0f2679a538e.tar.gz
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
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_ioctl.c22
-rw-r--r--sys/compat/linux/linux_ioctl.h6
2 files changed, 28 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index 33775c5..c457d12 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -96,6 +96,7 @@ static linux_ioctl_function_t linux_ioctl_drm;
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_handler =
{ 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, private_handler);
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, struct linux_ioctl_args *args)
}
/*
+ * 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
*/
diff --git a/sys/compat/linux/linux_ioctl.h b/sys/compat/linux/linux_ioctl.h
index 5eb0c59..5503362 100644
--- a/sys/compat/linux/linux_ioctl.h
+++ b/sys/compat/linux/linux_ioctl.h
@@ -611,4 +611,10 @@ int linux_ifname(struct ifnet *, char *, size_t);
#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_ */
OpenPOWER on IntegriCloud