From owner-svn-src-head@freebsd.org Wed Oct 2 12:59:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8EAD12E5E5; Wed, 2 Oct 2019 12:59:21 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46jx6d4PXjz4NR7; Wed, 2 Oct 2019 12:59:21 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 765C4260341; Wed, 2 Oct 2019 14:59:06 +0200 (CEST) Subject: Re: svn commit: r338679 - head/lib/libusb To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head References: <201809141341.w8EDfbtO070815@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <176b6c74-947c-0e0e-6568-effcfac9cd8f@selasky.org> Date: Wed, 2 Oct 2019 14:58:17 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46jx6d4PXjz4NR7 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Oct 2019 12:59:21 -0000 On 2019-10-02 14:55, Kyle Evans wrote: > On Fri, Sep 14, 2018 at 8:41 AM Hans Petter Selasky > wrote: >> >> Author: hselasky >> Date: Fri Sep 14 13:41:37 2018 >> New Revision: 338679 >> URL: https://svnweb.freebsd.org/changeset/base/338679 >> >> Log: >> Improve LibUSB debugging by simultaneously allowing both function >> and transfer prints. Make sure the debug level comes from the >> correct USB context. >> >> Found by: Ludovic Rousseau >> PR: 231264 >> MFC after: 1 week >> Approved by: re (kib) >> Sponsored by: Mellanox Technologies >> >> Modified: >> head/lib/libusb/libusb10.h >> head/lib/libusb/libusb10_io.c >> >> Modified: head/lib/libusb/libusb10.h >> ============================================================================== >> --- head/lib/libusb/libusb10.h Fri Sep 14 01:52:34 2018 (r338678) >> +++ head/lib/libusb/libusb10.h Fri Sep 14 13:41:37 2018 (r338679) >> @@ -41,22 +41,24 @@ >> #define HOTPLUG_LOCK(ctx) pthread_mutex_lock(&(ctx)->hotplug_lock) >> #define HOTPLUG_UNLOCK(ctx) pthread_mutex_unlock(&(ctx)->hotplug_lock) >> >> -#define DPRINTF(ctx, dbg, format, args...) do { \ >> - if ((ctx)->debug == dbg) { \ >> - switch (dbg) { \ >> - case LIBUSB_DEBUG_FUNCTION: \ >> - printf("LIBUSB_FUNCTION: " \ >> - format "\n", ## args); \ >> - break; \ >> - case LIBUSB_DEBUG_TRANSFER: \ >> - printf("LIBUSB_TRANSFER: " \ >> - format "\n", ## args); \ >> - break; \ >> - default: \ >> - break; \ >> - } \ >> - } \ >> -} while(0) >> +#define DPRINTF(ctx, dbg, format, ...) do { \ >> + switch (dbg) { \ >> + case LIBUSB_DEBUG_FUNCTION: \ >> + if ((ctx)->debug & LIBUSB_DEBUG_FUNCTION) { \ >> + printf("LIBUSB_FUNCTION: " \ >> + format "\n", ## __VA_ARGS__); \ >> + } \ >> + break; \ >> + case LIBUSB_DEBUG_TRANSFER: \ >> + if ((ctx)->debug & LIBUSB_DEBUG_TRANSFER) { \ >> + printf("LIBUSB_TRANSFER: " \ >> + format "\n", ## __VA_ARGS__); \ >> + } \ >> + break; \ >> + default: \ >> + break; \ >> + } \ >> +} while (0) >> >> /* internal structures */ >> > > Hi, > > How are people/users of libusb supposed to disable these messages > after this? The only thing stopping them was the debug level in the > context, I guess, because DPRINTF is always compiled to this and the > users of DPRINTF are just invoking it all willy-nilly. > Feel free to submit a patch. Maybe you need to make a new option for user-space like WITH_USB_DEBUG .... --HPS