From owner-freebsd-usb@FreeBSD.ORG Mon Aug 12 09:20:01 2013 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C3390D00 for ; Mon, 12 Aug 2013 09:20:01 +0000 (UTC) (envelope-from hps@bitfrost.no) Received: from mta.bitpro.no (mta.bitpro.no [92.42.64.202]) by mx1.freebsd.org (Postfix) with ESMTP id 7FFA0275B for ; Mon, 12 Aug 2013 09:20:01 +0000 (UTC) Received: from mail.lockless.no (mail.lockless.no [46.29.221.38]) by mta.bitpro.no (Postfix) with ESMTP id B853F7A22C; Mon, 12 Aug 2013 11:19:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.lockless.no (Postfix) with ESMTP id 7C6EE8F2F8A; Mon, 12 Aug 2013 11:20:07 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at lockless.no Received: from mail.lockless.no ([127.0.0.1]) by localhost (mail.lockless.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2ac7koYHna4t; Mon, 12 Aug 2013 11:20:06 +0200 (CEST) Received: from laptop015.hselasky.homeunix.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) by mail.lockless.no (Postfix) with ESMTPSA id 753558F2F88; Mon, 12 Aug 2013 11:20:06 +0200 (CEST) Message-ID: <5208A912.2050002@bitfrost.no> Date: Mon, 12 Aug 2013 11:21:22 +0200 From: Hans Petter Selasky Organization: Bitfrost A/S User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130522 Thunderbird/17.0.6 MIME-Version: 1.0 To: Damjan Jovanovic Subject: Re: COMPAT_32BIT libusb ABI problem References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Aug 2013 09:20:01 -0000 On 07/24/13 22:09, Damjan Jovanovic wrote: > Hi > > The ioctl: > #define USB_FS_INIT _IOW ('U', 195, struct usb_fs_init) > when used by a COMPAT_32BIT libusb on amd64, fails (causing > libusb_open() to fail) due to: > > freebsd32_ioctl(0x6,0x800c55c3,0xffffc710,0x0,0x0,0x0) ERR#25 > 'Inappropriate ioctl for device' > but when hacked a bit: > freebsd32_ioctl(0x6,0x801055c3,0xffffc710,0x0,0x0,0x0) = 0 (0x0) > > because sizeof(struct usb_fs_init) is 12 bytes on i386, and 16 bytes on amd64. > > But the failure of even libusb_open() - a fundamental libusb function > - must mean that the COMPAT_32BIT libusb never worked. Can we please > take this opportunity to kill it and do a real 32 bit compatibility > layer in the kernel that will work from 32 bit chroots and statically > linked 32 bit binaries? I'll help. Hi, Some further analysis shows that this is due to structures being aligned to their biggest element on AMD64 while on I386 not. This should now be fixed. Please see the following commit: http://svnweb.freebsd.org/changeset/base/254243 You will need to use the LibUSB-32 built by the 64-bit system build, and not the I386 one, which has COMPAT_32BIT set. Thank you! --HPS