From owner-freebsd-usb@FreeBSD.ORG Tue Aug 31 20:46:52 2010 Return-Path: Delivered-To: usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90EFA10656A4 for ; Tue, 31 Aug 2010 20:46:52 +0000 (UTC) (envelope-from kc5vdj.freebsd@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 39D078FC15 for ; Tue, 31 Aug 2010 20:46:51 +0000 (UTC) Received: by gxk24 with SMTP id 24so3176070gxk.13 for ; Tue, 31 Aug 2010 13:46:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=QorGKUBBwuKorllOyQgB6yFQVBDHXkpjG1koZgGGVKo=; b=tuetgnqk2MUrB9ccLbkTF2xQOQZOqUmXbHIQNfeXy2WAEMqStt9PZBKJFnmrexpxSI 90Gqf9gLWIEkXi66vDHiKABaIdlitpw9/cBshSoH875pWCUXBZoQVrdjhHCdfjtlJklV apz3rg5Vwz3aM2dS+NP3Rvee9wGQDJI3aNWCg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=WqE9eCdyVXQ7WOiFFA2bekE6oqdD3ce89R3vZrHsM03+AeiOl47zGiug6YacAFvxuW q+9LQRNel+5dq2D3oYo8RfloKB0qgxrBpUGW6xwBwoBCRHZfcYBdaewjQm/FQ/YBJgqE IubdPFVei/Yyi91T5ubItToLE0KHBwuy968dg= Received: by 10.90.80.4 with SMTP id d4mr5458395agb.12.1283287610051; Tue, 31 Aug 2010 13:46:50 -0700 (PDT) Received: from orb.electron-tube.net (71-217-215-181.cdrr.qwest.net [71.217.215.181]) by mx.google.com with ESMTPS id r3sm9173930ibk.7.2010.08.31.13.46.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 31 Aug 2010 13:46:49 -0700 (PDT) Message-ID: <4C7D6A34.9030000@gmail.com> Date: Tue, 31 Aug 2010 15:46:44 -0500 From: Jim Bryant User-Agent: Thunderbird 2.0.0.24 (X11/20100731) MIME-Version: 1.0 To: Alexander Leidinger References: <20100830174232.56765zlyg2rhuhgc@webmail.leidinger.net> <4C7C4B59.3090207@gmail.com> <20100831152432.1145726oycad08w0@webmail.leidinger.net> In-Reply-To: <20100831152432.1145726oycad08w0@webmail.leidinger.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: usb@FreeBSD.org Subject: Re: Porting an USB software from linux (libusb) X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 20:46:52 -0000 ah, i'm under -stable. Alexander Leidinger wrote: > Quoting Jim Bryant (from Mon, 30 Aug 2010 > 19:22:49 -0500): > >> easy fix. just drop the _np >> >> the functions are there under legacy naming. > > Not in my revision of FreeBSD-current. I commented it out like HPS > suggested (the right way, with the correct macros to enable > automatically when those functions are merged from P4 to SVN) and the > linker doesn't complain anymore. > > Bye, > Alexander. > >> Alexander Leidinger wrote: >>> Hi, >>> >>> I try to port a linux userland USB program and I get the following >>> error message when trying to link to libusb (current as of r210105): >>> ---snip--- >>> cc -lusb -lm -o fowsr fowsr.o >>> fowsr.o(.text+0x1546): In function `CUSB_Open': >>> : undefined reference to `usb_get_driver_np' >>> fowsr.o(.text+0x1710): In function `CUSB_Open': >>> : undefined reference to `usb_detach_kernel_driver_np' >>> gmake: *** [fowsr] Fehler 1 >>> ---snip--- >>> >>> Do I need those functions on FreeBSD (the device may show up as a >>> HID device, I hadn't a chance to attach it to a FreeBSD box yet), or >>> can I just remove them (I could make sure the HID driver is not >>> loaded in the kernel)? >>> >>> Here is the related source: >>> ---snip--- >>> devh = usb_open(dev); >>> assert(devh); >>> >>> signal(SIGTERM, release_usb_device); >>> >>> ret = usb_get_driver_np(devh, 0, buf, sizeof(buf)); >>> printf("usb_get_driver_np returned %d\n", ret); >>> if (ret == 0) { >>> printf("interface 0 already claimed by driver >>> \\'%s\\', attempting to detach it\n", buf); >>> ret = usb_detach_kernel_driver_np(devh, 0); >>> printf("usb_detach_kernel_driver_np returned %d\n", >>> ret); >>> } >>> ret = usb_claim_interface(devh, 0); >>> if (ret != 0) { >>> printf("claim failed with error %d\n", ret); >>> exit(1); >>> } >>> >>> ret = usb_set_altinterface(devh, 0); >>> ---snip--- >>> >>> Bye, >>> Alexander. >>> >> >> > > >