ltib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ltib] Troubles Adding libusb(x)


From: Peter Barada
Subject: Re: [Ltib] Troubles Adding libusb(x)
Date: Thu, 28 Mar 2013 20:48:36 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4

On 03/28/2013 06:13 PM, Chermak, Dale wrote:

Greetings.

 

Full disclosure: I am new to using LTIB and not an expert developing for Linux having done primarily Windows development over the years.

 

I have a DM3730 Torpedo + Wireless SOM from LogicPD that uses LTIB. I have managed to get the Ubuntu 10.04 LTS development environment setup, build a custom target image and add my own hellotorpedo-1.0 package to the image. All good so far. Now I am trying to get to work on the actual project which involves communicating with a USB device. Years ago, some summer interns wrote an application for the OLPC that used libusb to communicate with a similar USB device. I figured I would just use libusb for this current project, leveraging whatever code I could salvage from the OLPC project. I created a simple project, usbtest, to get started. Launching make from the LTIB shell resulted in the following (first) error:

 

usbtest.cpp:3:20: error: libusb.h: No such file or directory

 

Sure enough, a not even a find / -iname ‘libusb.h’ got any hits. Firing up ./ltib -c I noticed that the libusb package has --- instead of [   ] or [ * ], so no way for me to add or remove it I guess?

 

Searching around I discovered some posts on the Ubuntu forums that mentioned doing an apt-get for libusb-1.0-X-dev instead of libusb-dev to use libusb for development, which I guess is another way of getting the headers. So perhaps the libusb package does not include the headers? It also appears to be the ‘old’ version which does not support asynchronous I/O.

 

At this point, I have gone ahead and downloaded the libusbx (a supposedly more active fork of libusb) tarball. It has what I guess is a fairly standard ./configure, make and make install workflow. I ran ./configure --host=arm-linux and that seemed to work. I ran make, and things compiled and linked successfully. But I am not sure what to do next. Running make install does what I suspected and tries to install things in Ubuntu, but I want it installed in my LTIB environment so I can have the shared archive pulled into target image and be able to compile and link my usbtest project against it. I took a look at the libusb.spec and I suspect using a libusbx.spec file is the proper way to do this, but I am not sure what all the steps are, particularly getting the headers and shared archive available for the usbtest project. How should I proceed?

 

Sorry for the lengthy description but I wanted to make sure I had enough detail.

 


Dale, the "---" indicates that libusb is already incorporated in your build from LTIB (its selected by "PKG_USBTILS && CAP_HAS_MMU" which are both enabled for the LogicPD OMAP35x/DM37x platform).

Digging into the generated rootfs, there's no libusb.h installed by version 0.1.8 distributed as part of LTIB.  I think (but don't know if) you might have better luck upgrading the libusb package to the latest version rather than trying to install libusbx instead.  If you download http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2 and copy it to /opt/ltib/pkgs, and modify your dist/lfs-5.1/libusb/libusb.spec with the following patch:

Index: libusb.spec
===================================================================
--- libusb.spec    (revision 33943)
+++ libusb.spec    (working copy)
@@ -2,13 +2,13 @@
 
 Summary         : A library which allows userspace access to USB devices
 Name            : libusb
-Version         : 0.1.8
+Version         : 1.0.9
 Release         : 1
 License         : LGPL
 Vendor          : Freescale
 Packager        : Stuart Hughes
 Group           : System Environment/Libraries
-Source          : %{name}-%{version}.tar.gz
+Source          : %{name}-%{version}.tar.bz2
 BuildRoot       : %{_tmppath}/%{name}
 Prefix          : %{pfx}
 
@@ -17,7 +17,7 @@
 
 %Prep
 %setup
-libtoolize --copy --force
+# libtoolize --copy --force
 
 %Build
 # note: I tried version 0.1.10a buy this requires a c++ compiler


Then "./ltib -p libusb" _should_ install into your rootfs "rootfs/usr/include/libusb-1.0/libusb.h" that you could include in your application.  This version of libusb installs:

address@hidden:~/work/logic/eps_svn/software/products/linux/LTIB/trunk/ltib-3.0$ rpm2cpio < rpm/RPMS/arm/libusb-1.0.9-1.arm.rpm | cpio -t
./opt/freescale/rootfs/arm/usr
./opt/freescale/rootfs/arm/usr/include
./opt/freescale/rootfs/arm/usr/include/libusb-1.0
./opt/freescale/rootfs/arm/usr/include/libusb-1.0/libusb.h
./opt/freescale/rootfs/arm/usr/lib
./opt/freescale/rootfs/arm/usr/lib/libusb-1.0.a
./opt/freescale/rootfs/arm/usr/lib/libusb-1.0.so
./opt/freescale/rootfs/arm/usr/lib/libusb-1.0.so.0
./opt/freescale/rootfs/arm/usr/lib/libusb-1.0.so.0.1.0
./opt/freescale/rootfs/arm/usr/lib/pkgconfig
./opt/freescale/rootfs/arm/usr/lib/pkgconfig/libusb-1.0.pc
893 blocks

where "./opt/freescale/rootfs/arm/" is removed from the path when the RPM is ultimately installed - the rest is relative to the LTIB rootfs/ directory where all the packages are installed and the rootfs/ directory is what is used to populate your rootfs that you load onto the target.

Note that I've only complied tested this, not run it on actual hardware so your "results may vary".  Hope this helps - keep the list posted on your progress.
-- 
Peter Barada
address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]