Skip to content

Instantly share code, notes, and snippets.

@snim2
Created September 17, 2012 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snim2/3738493 to your computer and use it in GitHub Desktop.
Save snim2/3738493 to your computer and use it in GitHub Desktop.
BitBake recipe for LibHid (author: Matthew Murray)
--- swig/hid_wrap.c 2009-01-22 15:57:51.000000000 +0000
+++ swig/hid_wrap2.c 2009-01-27 15:00:29.000000000 +0000
@@ -1987,7 +1987,7 @@
int newmemory = 0;
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
if (newmemory == SWIG_CAST_NEW_MEMORY) {
- assert(own);
+ // assert(own);
if (own)
*own = *own | SWIG_CAST_NEW_MEMORY;
}
@@ -2070,7 +2070,7 @@
if (tc) {
int newmemory = 0;
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
+ // assert(!newmemory); /* newmemory handling not yet implemented */
} else {
return SWIG_ERROR;
}
Index: /src/hid_opening.c
===================================================================
--- /src/hid_opening.c (revision 318)
+++ src/hid_opening.c (revision 355)
@@ -119,5 +119,5 @@
struct usb_device const* dev = usb_device((usb_dev_handle*)dev_h);
-
+
TRACE("inspecting vendor ID...");
if (dev->descriptor.idVendor > 0 &&
@@ -176,4 +232,7 @@
if (ret != HID_RET_SUCCESS) return ret;
+ TRACE("add open device to list...");
+ add_open_device(hidif);
+
NOTICE("successfully opened USB device %s.", hidif->id);
return HID_RET_SUCCESS;
@@ -222,4 +281,7 @@
if (ret != HID_RET_SUCCESS) return ret;
+ TRACE("add open device to list...");
+ add_open_device(hidif);
+
NOTICE("successfully opened USB device %s.", hidif->id);
return HID_RET_SUCCESS;
@@ -249,4 +311,7 @@
}
else WARNING("attempt to close unopened USB device %s.", hidif->id);
+
+ TRACE("remove hidif from open list...");
+ remove_open_device(hidif);
if (hidif->hid_parser) hid_reset_parser(hidif);
@@ -255,5 +320,5 @@
if(hidif->hid_parser) free(hidif->hid_parser);
if(hidif->hid_data) free(hidif->hid_data);
-
+
TRACE("resetting HIDInterface...");
hid_reset_HIDInterface(hidif);
DESCRIPTION = "User-space HID access library, including Python bindings."
LICENSE = "GPL"
DEPENDS = "swig python install-native"
SECTION = "devel"
PRIORITY = "optional"
SRCNAME = "libhid"
SRC_URI = "file://libhid-bugfix.tgz \
file://changeset.diff;patch=1 \
file://assertpatch.diff;pnum=0;patch=1"
S = "${WORKDIR}/libhid-0.2.15+20060325/"
inherit autotools distutils-base
do_configure() {
cd ${S}
./configure --without-doxygen --host=armv5te-angstrom-linux-gnueabi --enable-swig --build=i686-linux --target=arm-angstrom-linux-gnueabi --without-distcc
}
do_compile() {
cd ${S}
oe_runmake
cd ${S}/swig
oe_runmake
}
do_stage() {
install -m 0755 -d ${STAGING_LIBDIR}
install -m 0755 -d ${STAGING_INCDIR}/libhid
install -m 644 ${S}include/hid.h ${STAGING_INCDIR}
install -m 644 ${S}hidparser/*.h ${STAGING_INCDIR}
install -m 755 ${S}src/.libs/*so* ${STAGING_libdir}
# SWIG bindings
install -m 0755 ${S}swig/.libs/*so* ${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/hid/
install -m 0755 ${S}swig/__init__.py ${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/hid/
}
do_install() {
install -m 0755 -d ${D}${libdir}
install -m 0755 -d ${D}${includedir}/libhid
install -m 644 ${S}include/hid.h ${D}${includedir}
install -m 644 ${S}include/assert.h ${D}${includedir}
install -m 644 ${S}hidparser/*.h ${D}${includedir}
install -m 644 ${S}src/.libs/*so* ${D}${libdir}
# SWIG bindings
install -m 0755 -d ${D}${libdir}/${PYTHON_DIR}/site-packages/hid/
cp -a ${S}swig/.libs/* ${D}${libdir}/${PYTHON_DIR}/site-packages/hid/
cp -a ${S}swig/__init__.py ${D}${libdir}/${PYTHON_DIR}/site-packages/hid/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment