libusb on MacOSX 10.6

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
hvn
Beiträge: 257
Registriert: 20 Feb 2011, 11:15

libusb on MacOSX 10.6

Beitrag von hvn » 19 Apr 2012, 08:45

Hello,

I'm trying to get libroboint (new name for libft by defiant) running on MacOSX, but it has a dependency on libusb. It has been ported as libusb-devel using Macports, but I'm not sure this will work. Before I start "(re)inventing the wheel", can anyone tell me if this works and how?

Thank you.

Benutzeravatar
Defiant
Beiträge: 356
Registriert: 31 Okt 2010, 21:42
Wohnort: Narn Homeworld
Kontaktdaten:

Re: libusb on MacOSX 10.6

Beitrag von Defiant » 19 Apr 2012, 09:03

It has been tested once, a few years ago. So it should work. Just go to http://www.libusb.org/, Download libusb-0.1 and follow the install instructions.
"Propaganda does not deceive people; it merely helps them to deceive themselves."
E Hoffer

hvn
Beiträge: 257
Registriert: 20 Feb 2011, 11:15

Re: libusb on MacOSX 10.6

Beitrag von hvn » 19 Apr 2012, 09:24

I downloaded v. 0.1.12. While ./configure goes well, make shows this:

cc1: warnings being treated as errors
darwin.c: In function ‘usb_get_next_device’:
darwin.c:257: warning: passing argument 5 of ‘IOCreatePlugInInterfaceForService’ from incompatible pointer type
darwin.c: In function ‘claim_interface’:
darwin.c:560: warning: passing argument 5 of ‘IOCreatePlugInInterfaceForService’ from incompatible pointer type
darwin.c: In function ‘rw_completed’:
darwin.c:772: warning: cast from pointer to integer of different size
darwin.c:772: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘unsigned int’
darwin.c:774: warning: cast from pointer to integer of different size
darwin.c: In function ‘usb_os_find_devices’:
darwin.c:1067: warning: format ‘%08lx’ expects type ‘long unsigned int’, but argument 3 has type ‘UInt32’
darwin.c:1095: warning: format ‘%08lx’ expects type ‘long unsigned int’, but argument 5 has type ‘UInt32’
make[2]: *** [darwin.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

So I wonder if this is due to OSX having changed or other things. Unfortunately, the libusb FAQ is only about Linux. How many are using libft/libroboint on Linux/Mac ?

thomass
Beiträge: 42
Registriert: 19 Apr 2012, 14:29

Re: libusb on MacOSX 10.6

Beitrag von thomass » 19 Apr 2012, 14:44

That's because MacOSX is now 64bit per default.
The code assumes 32bit pointers.
After modifiying it a little bit it compiles without warning but I haven't checked funtionality though.

Cheers,
Thomas

hvn
Beiträge: 257
Registriert: 20 Feb 2011, 11:15

Re: libusb on MacOSX 10.6

Beitrag von hvn » 19 Apr 2012, 16:32

Hi Thomas,

Didn't think about the 64 bit thing. Can you tell me which modifications you've made? Or send me your new version..?

Thank you.

Benutzeravatar
Defiant
Beiträge: 356
Registriert: 31 Okt 2010, 21:42
Wohnort: Narn Homeworld
Kontaktdaten:

Re: libusb on MacOSX 10.6

Beitrag von Defiant » 19 Apr 2012, 17:19

Maybe it works with the ports version now: https://trac.macports.org/ticket/20131
"Propaganda does not deceive people; it merely helps them to deceive themselves."
E Hoffer

thomass
Beiträge: 42
Registriert: 19 Apr 2012, 14:29

Re: libusb on MacOSX 10.6

Beitrag von thomass » 19 Apr 2012, 17:27

Hi,

Since I don't know if there is a way to easily post files on this for8um I will give you some instructions to modify darwin.c by yourself.

1. change the type of "score" in line 250 from "long" to "SInt32"
2. Same in line 450, change the type of "score" from "long" to "SInt32"
3. In line 761 change the type of "io_size" from "UInt32" to "unsigned long int"
4. In lines 772 and 774 change the type cast of "io_size" from "(UInt32)" to "(unsigned long int)"
5. In lines 1067 and 1094 change the conversion specifiers from "%08lx" to "%08x"

That's all to get at least libusb running. However libusbpp crashes but it seems to be not necessary for libft/libroboint.

-Thomas

hvn
Beiträge: 257
Registriert: 20 Feb 2011, 11:15

Re: libusb on MacOSX 10.6

Beitrag von hvn » 20 Apr 2012, 09:11

Ok. I installed libusb from macports so libusb is installed in /opt/local/lib. I adjusted .profile, but apparently I don't get the PATH correct because I get this:

$ cmake .
-- Found Python: /Library/Frameworks/Python.framework/Versions/2.7/bin/python
-- Could not find Doxygen
-- Unable to create documentation!
CMake Error at LIBUSBConfig.cmake:14 (MESSAGE):
Could not find libusb
Call Stack (most recent call first):
lib/CMakeLists.txt:4 (FIND_PACKAGE)

So unless I can figure out what I did wrong here, I'm considering following Thomas's description, although that's for an obsolete version.

Benutzeravatar
Defiant
Beiträge: 356
Registriert: 31 Okt 2010, 21:42
Wohnort: Narn Homeworld
Kontaktdaten:

Re: libusb on MacOSX 10.6

Beitrag von Defiant » 20 Apr 2012, 15:36

"Propaganda does not deceive people; it merely helps them to deceive themselves."
E Hoffer

hvn
Beiträge: 257
Registriert: 20 Feb 2011, 11:15

Re: libusb on MacOSX 10.6

Beitrag von hvn » 20 Apr 2012, 21:51

Thank you for this link. I've been trying but and far no luck. But I'll keep trying.

Antworten