Reference

NJB_Set_Debug(3)

Set the mode for debugging traces

NAME

NJB_Set_Debug - Set the mode for debugging traces

LIBRARY

libnjb

SYNOPSIS

#include <libnjb.h>

extern int njb_error

NJB_Set_Debug (int debug_flags)

DESCRIPTION

NJB_Set_Debug sets the verbosity and cathegory of debug messages printed to the standard output during execution of a program using libnjb. This command is used mainly by developers, but application developers are encouraged to add a command-line option to turn debugging on, so that users may use this feature to locate problems in programs using libnjb.

ARGUMENT VALUES

The begug verbosity is selected by performing a logical OR operation between these possible debug messages:

DD_USBCTL

Dump control messages sent to the USB bus (i.e. endpoint 0) to stdout in hexadecimal notation. This is very good for tracing commands on the control channel used by NJB1.

DD_USBBLKIM

Obsolete.

DD_USBBLK

Dump bulk messages sent on the USB bus. These can be quite large, and may considerably slow down the operation of your program, especially if the trace is displayed in a terminal. This is however necessary for the series 3 devices, since these use the bulk exclusively, even for commands to the device.

DD_SUBTRACE

Dump a hierarchical trace stack of how functions inside libnjb are called so that it is possible to locate the problematic function by following the execution tree.

Example usage

Example: NJB_Debug(DD_USBCTL | DD_USBBLK | DD_SUBTRACE)