[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

            Bug ID: 231264
           Summary: libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O
                    done"); does not work in libusb10_do_transfer_cb()
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: usb
          Assignee: [hidden email]
          Reporter: [hidden email]

The _only_ use of DPRINTF(..., LIBUSB_DEBUG_TRANSFER, ...) is in the function
libusb10_do_transfer_cb of libusb10_io.c
https://github.com/freebsd/freebsd/blob/master/lib/libusb/libusb10_io.c#L500

The function uses it as:
ctx = GET_CONTEXT(NULL);
DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done");

Since the ctx context is fetched from NULL it has default values and ctx->debug
is 0.

DPRINTF() definition uses ctx->debug to know the debug level.
https://github.com/freebsd/freebsd/blob/master/lib/libusb/libusb10.h#L44

In the present case the debug level will be 0 so nothing is logged.

I don't know how to get the libusb context from a libusb_transfer, the only
parameter passed to libusb10_do_transfer_cb().

Another idea for improvement would be to use a bitmap for ctx->debug so it
would be possible to enable both LIBUSB_DEBUG_TRANSFER and
LIBUSB_DEBUG_FUNCTION at the same time.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

--- Comment #1 from Ludovic Rousseau <[hidden email]> ---
Created attachment 197047
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=197047&action=edit
Correctly et the context

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

--- Comment #2 from Ludovic Rousseau <[hidden email]> ---
The code ctx = GET_CONTEXT(NULL); is also used in

libusb_bulk_transfer() at
https://github.com/freebsd/freebsd/blob/master/lib/libusb/libusb10_io.c#L588

and

libusb_interrupt_transfer() at
https://github.com/freebsd/freebsd/blob/master/lib/libusb/libusb10_io.c#L606

Patch attached. It works for me.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

Hans Petter Selasky <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |In Progress

--- Comment #3 from Hans Petter Selasky <[hidden email]> ---
Patch looks good.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

--- Comment #4 from Ludovic Rousseau <[hidden email]> ---
The patch does not fix the problem for libusb10_do_transfer_cb().

Only for the 2 other uses of GET_CONTEXT(NULL).

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

Hans Petter Selasky <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #197047|0                           |1
        is obsolete|                            |

--- Comment #5 from Hans Petter Selasky <[hidden email]> ---
Created attachment 197056
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=197056&action=edit
LibUSB patch

Can you try this updated patch instead? Does it work for you?

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

--- Comment #6 from Ludovic Rousseau <[hidden email]> ---
This new patch works for me.

I would like to be able to have LIBUSB_DEBUG_FUNCTION *and*
LIBUSB_DEBUG_TRANSFER logs.

This is easy to do using:
  libusb_set_debug(ctx, LIBUSB_DEBUG_FUNCTION | LIBUSB_DEBUG_TRANSFER);
and the attached patch.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

--- Comment #7 from Ludovic Rousseau <[hidden email]> ---
Created attachment 197089
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=197089&action=edit
allows LIBUSB_DEBUG_FUNCTION and LIBUSB_DEBUG_TRANSFER

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

--- Comment #8 from [hidden email] ---
A commit references this bug:

Author: hselasky
Date: Fri Sep 14 13:41:37 UTC 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 <[hidden email]>
  PR:                   231264
  MFC after:            1 week
  Approved by:          re (kib)
  Sponsored by:         Mellanox Technologies

Changes:
  head/lib/libusb/libusb10.h
  head/lib/libusb/libusb10_io.c

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

Hans Petter Selasky <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|In Progress                 |Closed

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

--- Comment #9 from [hidden email] ---
A commit references this bug:

Author: hselasky
Date: Wed Sep 19 08:11:44 UTC 2018
New revision: 338791
URL: https://svnweb.freebsd.org/changeset/base/338791

Log:
  MFC r338679:
  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 <[hidden email]>
  PR:                   231264
  Sponsored by:         Mellanox Technologies

Changes:
_U  stable/11/
  stable/11/lib/libusb/libusb10.h
  stable/11/lib/libusb/libusb10_io.c

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

--- Comment #10 from [hidden email] ---
A commit references this bug:

Author: hselasky
Date: Wed Sep 19 08:12:41 UTC 2018
New revision: 338792
URL: https://svnweb.freebsd.org/changeset/base/338792

Log:
  MFC r338679:
  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 <[hidden email]>
  PR:                   231264
  Sponsored by:         Mellanox Technologies

Changes:
_U  stable/10/
  stable/10/lib/libusb/libusb10.h
  stable/10/lib/libusb/libusb10_io.c

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 231264] libusb DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); does not work in libusb10_do_transfer_cb()

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231264

--- Comment #11 from [hidden email] ---
A commit references this bug:

Author: hselasky
Date: Wed Sep 19 08:13:58 UTC 2018
New revision: 338793
URL: https://svnweb.freebsd.org/changeset/base/338793

Log:
  MFC r338679:
  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 <[hidden email]>
  PR:                   231264
  Sponsored by:         Mellanox Technologies

Changes:
_U  stable/9/lib/
_U  stable/9/lib/libusb/
  stable/9/lib/libusb/libusb10.h
  stable/9/lib/libusb/libusb10_io.c

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[hidden email]"