From owner-p4-projects@FreeBSD.ORG Wed Jun 17 19:29:14 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2ED281065670; Wed, 17 Jun 2009 19:29:14 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3364106564A for ; Wed, 17 Jun 2009 19:29:13 +0000 (UTC) (envelope-from syl@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id D08EB8FC1B for ; Wed, 17 Jun 2009 19:29:13 +0000 (UTC) (envelope-from syl@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5HJTDns079483 for ; Wed, 17 Jun 2009 19:29:13 GMT (envelope-from syl@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5HJTDlG079476 for perforce@freebsd.org; Wed, 17 Jun 2009 19:29:13 GMT (envelope-from syl@FreeBSD.org) Date: Wed, 17 Jun 2009 19:29:13 GMT Message-Id: <200906171929.n5HJTDlG079476@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to syl@FreeBSD.org using -f From: Sylvestre Gallon To: Perforce Change Reviews Cc: Subject: PERFORCE change 164613 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 19:29:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=164613 Change 164613 by syl@syl_atuin on 2009/06/17 19:29:13 - Add skeleton to transfers unimplemented test to allow them to compile. - Implement transfer debug. Affected files ... .. //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test2/test2.c#2 edit .. //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test3/test3.c#2 edit .. //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test4/test4.c#2 edit .. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb.h#12 edit .. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.c#38 edit .. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.h#8 edit .. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_io.c#13 edit Differences ... ==== //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test2/test2.c#2 (text+ko) ==== @@ -1,0 +1,14 @@ +#include +#include +#include +#include + +#define PID_TEST 0x8300 +#define VID_TEST 0x05ac + +libusb_context *ctx; + +int main(int ac, char *av[]) +{ + return (EXIT_SUCCESS); +} ==== //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test3/test3.c#2 (text+ko) ==== @@ -1,0 +1,14 @@ +#include +#include +#include +#include + +#define PID_TEST 0x8300 +#define VID_TEST 0x05ac + +libusb_context *ctx; + +int main(int ac, char *av[]) +{ + return (EXIT_SUCCESS); +} ==== //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test4/test4.c#2 (text+ko) ==== @@ -1,0 +1,14 @@ +#include +#include +#include +#include + +#define PID_TEST 0x8300 +#define VID_TEST 0x05ac + +libusb_context *ctx; + +int main(int ac, char *av[]) +{ + return (EXIT_SUCCESS); +} ==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb.h#12 (text+ko) ==== @@ -179,6 +179,7 @@ enum libusb_debug_level { LIBUSB_DEBUG_NO=0, LIBUSB_DEBUG_FUNCTION=1, + LIBUSB_DEBUG_TRANSFER=2, }; /* libusb structures */ ==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.c#38 (text+ko) ==== @@ -38,11 +38,6 @@ #include "libusb.h" #include "libusb10.h" -/* - * XXX TODO - * - implement debug messages. - */ - static pthread_mutex_t default_context_lock = PTHREAD_MUTEX_INITIALIZER; struct libusb_context *usbi_default_context = NULL; pthread_mutex_t libusb20_lock = PTHREAD_MUTEX_INITIALIZER; @@ -839,9 +834,11 @@ status = libusb20_tr_get_status(xfer); usb_xfer = libusb20_tr_get_priv_sc0(xfer); ctx = usb_xfer->dev_handle->dev->ctx; + GET_CONTEXT(ctx); switch (status) { case LIBUSB20_TRANSFER_COMPLETED: + dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 SUBMIT"); usb_xfer->actual_length += libusb20_tr_get_actual_length(xfer); usb_xfer->callback(usb_xfer); @@ -850,6 +847,7 @@ pthread_mutex_unlock(&ctx->flying_transfers_lock); break ; case LIBUSB20_TRANSFER_START: + dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 START"); usb_xfer->actual_length = 0; switch (usb_xfer->type) { case LIBUSB_TRANSFER_TYPE_CONTROL: @@ -887,21 +885,27 @@ switch (status) { case LIBUSB20_TRANSFER_COMPLETED: + dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS COMPLETED"); xfer->status = LIBUSB_TRANSFER_COMPLETED; break ; case LIBUSB20_TRANSFER_OVERFLOW: + dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR OVERFLOW"); xfer->status = LIBUSB_TRANSFER_OVERFLOW; break ; case LIBUSB20_TRANSFER_NO_DEVICE: + dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR NO DEVICE"); xfer->status = LIBUSB_TRANSFER_NO_DEVICE; break ; case LIBUSB20_TRANSFER_STALL: + dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR STALL"); xfer->status = LIBUSB_TRANSFER_STALL; break ; case LIBUSB20_TRANSFER_CANCELLED: + dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR CANCELLED"); xfer->status = LIBUSB_TRANSFER_CANCELLED; break ; case LIBUSB20_TRANSFER_TIMED_OUT: + dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR TIMEOUT"); xfer->status = LIBUSB_TRANSFER_TIMED_OUT; break ; default: ==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.h#8 (text+ko) ==== @@ -92,6 +92,9 @@ case LIBUSB_DEBUG_FUNCTION: printf("LIBUSB FUNCTION : %s\n", str); break ; + case LIBUSB_DEBUG_TRANSFER: + printf("LIBUSB TRANSFER : %s\n", str); + break ; default: printf("LIBUSB UNKNOW DEBUG\n"); break ; ==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_io.c#13 (text+ko) ==== @@ -533,8 +533,13 @@ static void ctrl_tr_cb(struct libusb_transfer *transfer) { - int *complet = transfer->user_data; + libusb_context *ctx; + int *complet; + + ctx = NULL; + dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "CALLBACK ENTER"); + complet = transfer->user_data; *complet = 1; }