mirror of
https://github.com/linux-usb-gadgets/libusbgx.git
synced 2025-07-24 02:35:07 +03:00
libusbgx: examples: Allow show-gadgets to print HID function attrs
As libusbgx now supports also HID function so we may print its attributes in our show-gadgets example. This may also be used as example of getting HID attributes using generic functions. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
This commit is contained in:
parent
b656ce0845
commit
e323f6c0f9
1 changed files with 19 additions and 1 deletions
|
@ -28,7 +28,7 @@
|
|||
#include <usbg/function/ffs.h>
|
||||
#include <usbg/function/phonet.h>
|
||||
#include <usbg/function/midi.h>
|
||||
|
||||
#include <usbg/function/hid.h>
|
||||
|
||||
/**
|
||||
* @file show-gadgets.c
|
||||
|
@ -128,6 +128,7 @@ void show_function(usbg_function *f)
|
|||
struct usbg_f_midi_attrs midi;
|
||||
int serial_port_num;
|
||||
char *phonet_ifname;
|
||||
struct usbg_f_hid_attrs hid;
|
||||
} f_attrs;
|
||||
|
||||
instance = usbg_get_function_instance(f);
|
||||
|
@ -210,6 +211,23 @@ void show_function(usbg_function *f)
|
|||
fprintf(stdout, " qlen\t\t%d\n", attrs->qlen);
|
||||
break;
|
||||
}
|
||||
case USBG_F_HID:
|
||||
{
|
||||
struct usbg_f_hid_attrs *attrs = &f_attrs.hid;
|
||||
int i;
|
||||
|
||||
fprintf(stdout, " dev\t\t\t%d:%d\n",
|
||||
major(attrs->dev), minor(attrs->dev));
|
||||
fprintf(stdout, " protocol\t\t%d\n", attrs->protocol);
|
||||
fprintf(stdout, " report_desc\t");
|
||||
for (i = 0; i < attrs->report_desc.len; ++i)
|
||||
fprintf(stdout, "%x", attrs->report_desc.desc[i]);
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, " report_length\t%d\n",
|
||||
attrs->report_length);
|
||||
fprintf(stdout, " subclass\t\t%d\n", attrs->subclass);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
fprintf(stdout, " UNKNOWN\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue