allow to compile usb support again

This commit is contained in:
matthias.ringwald 2009-10-17 22:38:48 +00:00
parent a0527f5745
commit c35f2df118
3 changed files with 10 additions and 10 deletions

View File

@ -151,6 +151,7 @@ echo
# create config.h # create config.h
echo "// config.h created by configure for BTstack " `date`> config.h echo "// config.h created by configure for BTstack " `date`> config.h
if test "x$HCI_TRANSPORT" = xUSB; then if test "x$HCI_TRANSPORT" = xUSB; then
USB_SOURCES=hci_transport_usb.c
echo "#define HAVE_TRANSPORT_USB" >> config.h echo "#define HAVE_TRANSPORT_USB" >> config.h
echo "#define USB_PRODUCT_ID $USB_PRODUCT_ID" >> config.h echo "#define USB_PRODUCT_ID $USB_PRODUCT_ID" >> config.h
echo "#define USB_VENDOR_ID $USB_VENDOR_ID" >> config.h echo "#define USB_VENDOR_ID $USB_VENDOR_ID" >> config.h
@ -176,6 +177,7 @@ fi
AC_SUBST(IPHONE_IP) AC_SUBST(IPHONE_IP)
AC_SUBST(HAVE_LIBUSB) AC_SUBST(HAVE_LIBUSB)
AC_SUBST(USE_LDID) AC_SUBST(USE_LDID)
AC_SUBST(USB_SOURCES)
AC_SUBST(SPRINGBOARD_ACCESS_SOURCES) AC_SUBST(SPRINGBOARD_ACCESS_SOURCES)
AC_SUBST(RUN_LOOP_SOURCES) AC_SUBST(RUN_LOOP_SOURCES)
AC_OUTPUT(Makefile src/Makefile example/Makefile SpringBoardAccess/Makefile) AC_OUTPUT(Makefile src/Makefile example/Makefile SpringBoardAccess/Makefile)

View File

@ -4,6 +4,7 @@ CPPFLAGS = @CPPFLAGS@ -I../include
prefix = @prefix@ prefix = @prefix@
springboard_access_sources = @SPRINGBOARD_ACCESS_SOURCES@ springboard_access_sources = @SPRINGBOARD_ACCESS_SOURCES@
usb_sources = @USB_SOURCES@
libBTstack_SOURCES = btstack.c hci_cmds.c linked_list.c run_loop.c run_loop_posix.c run_loop_cocoa.m socket_connection.c utils.c libBTstack_SOURCES = btstack.c hci_cmds.c linked_list.c run_loop.c run_loop_posix.c run_loop_cocoa.m socket_connection.c utils.c
@ -13,7 +14,7 @@ BTdaemon_SOURCES = $(libBTstack_SOURCES) \
hci.c \ hci.c \
hci_dump.c \ hci_dump.c \
hci_transport_h4.c \ hci_transport_h4.c \
$(usb_support) \ $(usb_sources) \
l2cap.c \ l2cap.c \
l2cap_signaling.c \ l2cap_signaling.c \
platform_iphone.c \ platform_iphone.c \
@ -34,7 +35,7 @@ BTdaemon: $(BTdaemon_SOURCES)
@USE_LDID@ export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate ; ldid -S $@ @USE_LDID@ export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate ; ldid -S $@
clean: clean:
rm -f libBTstack* BTdaemon *.o rm -rf libBTstack* BTdaemon *.o
install: install:
echo "installing BTdaemon in $(prefix)..." echo "installing BTdaemon in $(prefix)..."

View File

@ -17,8 +17,6 @@
// ACL Data 0 0 0x82 Bulk (IN) 32/64 // ACL Data 0 0 0x82 Bulk (IN) 32/64
// ACL Data 0 0 0x02 Bulk (OUT) 32/64 // ACL Data 0 0 0x02 Bulk (OUT) 32/64
#ifdef HAVE_TRANSPORT_USB
#include <stdio.h> #include <stdio.h>
#include <strings.h> #include <strings.h>
#include <unistd.h> /* UNIX standard function definitions */ #include <unistd.h> /* UNIX standard function definitions */
@ -118,7 +116,7 @@ static void event_callback(struct libusb_transfer *transfer)
} }
} }
static int usb_process(struct data_source *ds, int ready) { static int usb_process(struct data_source *ds) {
if (libusb_state != LIB_USB_TRANSFERS_ALLOCATED) return -1; if (libusb_state != LIB_USB_TRANSFERS_ALLOCATED) return -1;
struct timeval tv; struct timeval tv;
bzero(&tv, sizeof(struct timeval)); bzero(&tv, sizeof(struct timeval));
@ -173,7 +171,7 @@ static int usb_open(void *transport_config){
libusb_state = LIB_USB_KERNEL_DETACHED; libusb_state = LIB_USB_KERNEL_DETACHED;
// reserve access to device // reserve access to device
printf("claimed interface 0\n"); printf("claiming interface 0...\n");
libusb_claim_interface(handle, 0); libusb_claim_interface(handle, 0);
if (r < 0) { if (r < 0) {
fprintf(stderr, "usb_claim_interface error %d\n", r); fprintf(stderr, "usb_claim_interface error %d\n", r);
@ -196,6 +194,7 @@ static int usb_open(void *transport_config){
printf("endpoint %x, attributes %x\n", endpoint->bEndpointAddress, endpoint->bmAttributes); printf("endpoint %x, attributes %x\n", endpoint->bEndpointAddress, endpoint->bmAttributes);
} }
#endif #endif
libusb_set_debug(0,3);
// allocation // allocation
control_transfer = libusb_alloc_transfer(0); // 0 isochronous transfers CMDs control_transfer = libusb_alloc_transfer(0); // 0 isochronous transfers CMDs
@ -221,8 +220,8 @@ static int usb_open(void *transport_config){
data_source_t *ds = malloc(sizeof(data_source_t)); data_source_t *ds = malloc(sizeof(data_source_t));
ds->fd = pollfd[r]->fd; ds->fd = pollfd[r]->fd;
ds->process = usb_process; ds->process = usb_process;
run_loop_add(ds); run_loop_add_data_source(ds);
printf("%u: %x fd: %u, events %x\n", r, pollfd[r], pollfd[r]->fd, pollfd[r]->events); printf("%u: %x fd: %u, events %x\n", r, (unsigned int) pollfd[r], pollfd[r]->fd, pollfd[r]->events);
} }
// init state machine // init state machine
@ -340,5 +339,3 @@ hci_transport_t * hci_transport_usb_instance() {
} }
return hci_transport_usb; return hci_transport_usb;
} }
#endif