From owner-freebsd-usb@FreeBSD.ORG Mon Aug 30 15:58:37 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 EEABD10656AA for ; Mon, 30 Aug 2010 15:58:37 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de [217.11.53.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9D6708FC17 for ; Mon, 30 Aug 2010 15:58:37 +0000 (UTC) Received: from outgoing.leidinger.net (p57B3A971.dip.t-dialin.net [87.179.169.113]) by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id D0849844060 for ; Mon, 30 Aug 2010 17:42:35 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 04241111A for ; Mon, 30 Aug 2010 17:42:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1283182953; bh=HMfvSgoQc3EAc1aX9HDghRru2G79PiiA/1DIMJYO5vY=; h=Message-ID:Date:From:To:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding; b=L9yOsXi0hFYeQHzrr7UV8qvcJfUQYe+gtQ3Ao1imNw98Wpctee+i+gwL7LIKVjjAj RPzH4mdof6FKEVPklc/KgiZbUgnMyF1euCKRUJeXjBjUpQyS01eH2rt/73eQYeKhZo 668curaQ1sXkHP6ksf2X1Y0PT/9qFjdxj8VEgAvYDx6XhDyy9Rzp7ucDgMPLAiEjmJ 67CnC2t8MFtnhdJ7ATWpuTghKBfrG2vxKE+Hc5BpbkzRMo91JwDS6ljqQPZ8ah6gWF e8Am7kwA3ah/x3NXprIekU+Z/ELvFCOT3d8lv3cy/OihSC9wNi1U4TBmcts18ofsWy gB998ug8NuZBQ== Received: (from www@localhost) by webmail.leidinger.net (8.14.4/8.13.8/Submit) id o7UFgWec051837 for usb@FreeBSD.org; Mon, 30 Aug 2010 17:42:32 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.ec.europa.eu (pslux.ec.europa.eu [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Mon, 30 Aug 2010 17:42:32 +0200 Message-ID: <20100830174232.56765zlyg2rhuhgc@webmail.leidinger.net> Date: Mon, 30 Aug 2010 17:42:32 +0200 From: Alexander Leidinger To: usb@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-EBL-MailScanner-Information: Please contact the ISP for more information X-EBL-MailScanner-ID: D0849844060.A5698 X-EBL-MailScanner: Found to be clean X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN, SpamAssassin (not cached, score=-1.1, required 6, autolearn=disabled, ALL_TRUSTED -1.00, DKIM_SIGNED 0.10, DKIM_VALID -0.10, DKIM_VALID_AU -0.10) X-EBL-MailScanner-From: alexander@leidinger.net X-EBL-MailScanner-Watermark: 1283787758.52193@qU5ahVrA4LuBioD6Z5EfZg X-EBL-Spam-Status: No Cc: Subject: 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: Mon, 30 Aug 2010 15:58:38 -0000 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. -- Famous last words: http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137