---
name: "NJB_Set_Debug"
section: "3"
platform: "linux"
package: "libnjb-dev"
version: "1.2-2"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/NJB_Set_Debug"
---

# 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)
