Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Aug 2010 15:24:32 +0200
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        Jim Bryant <kc5vdj.freebsd@gmail.com>
Cc:        usb@FreeBSD.org
Subject:   Re: Porting an USB software from linux (libusb)
Message-ID:  <20100831152432.1145726oycad08w0@webmail.leidinger.net>
In-Reply-To: <4C7C4B59.3090207@gmail.com>
References:  <20100830174232.56765zlyg2rhuhgc@webmail.leidinger.net> <4C7C4B59.3090207@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoting Jim Bryant <kc5vdj.freebsd@gmail.com> (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.
>>
>
>



-- 
Star Trek Lives!

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100831152432.1145726oycad08w0>