Skip to content

Commit

Permalink
tools: ffs-aio-example: convert to new descriptor format
Browse files Browse the repository at this point in the history
Since commit [ac8dde1: “Add flags to descriptors block”] functionfs
supports a new descriptor format, so we update example application
to make it using recomended version of descriptors.

Acked-by: Michal Nazarewicz <[email protected]>
Signed-off-by: Robert Baldyga <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
Robert Baldyga authored and Felipe Balbi committed Jun 30, 2014
1 parent d2999e1 commit 0ebe991
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,22 @@
/******************** Descriptors and Strings *******************************/

static const struct {
struct usb_functionfs_descs_head header;
struct usb_functionfs_descs_head_v2 header;
__le32 fs_count;
__le32 hs_count;
struct {
struct usb_interface_descriptor intf;
struct usb_endpoint_descriptor_no_audio bulk_sink;
struct usb_endpoint_descriptor_no_audio bulk_source;
} __attribute__ ((__packed__)) fs_descs, hs_descs;
} __attribute__ ((__packed__)) descriptors = {
.header = {
.magic = htole32(FUNCTIONFS_DESCRIPTORS_MAGIC),
.magic = htole32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2),
.flags = htole32(FUNCTIONFS_HAS_FS_DESC |
FUNCTIONFS_HAS_HS_DESC),
.length = htole32(sizeof(descriptors)),
.fs_count = htole32(3),
.hs_count = htole32(3),
},
.fs_count = htole32(3),
.fs_descs = {
.intf = {
.bLength = sizeof(descriptors.fs_descs.intf),
Expand All @@ -61,6 +64,7 @@ static const struct {
.bmAttributes = USB_ENDPOINT_XFER_BULK,
},
},
.hs_count = htole32(3),
.hs_descs = {
.intf = {
.bLength = sizeof(descriptors.hs_descs.intf),
Expand Down
12 changes: 8 additions & 4 deletions tools/usb/ffs-aio-example/simple/device_app/aio_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,22 @@
/******************** Descriptors and Strings *******************************/

static const struct {
struct usb_functionfs_descs_head header;
struct usb_functionfs_descs_head_v2 header;
__le32 fs_count;
__le32 hs_count;
struct {
struct usb_interface_descriptor intf;
struct usb_endpoint_descriptor_no_audio bulk_sink;
struct usb_endpoint_descriptor_no_audio bulk_source;
} __attribute__ ((__packed__)) fs_descs, hs_descs;
} __attribute__ ((__packed__)) descriptors = {
.header = {
.magic = htole32(FUNCTIONFS_DESCRIPTORS_MAGIC),
.magic = htole32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2),
.flags = htole32(FUNCTIONFS_HAS_FS_DESC |
FUNCTIONFS_HAS_HS_DESC),
.length = htole32(sizeof(descriptors)),
.fs_count = htole32(3),
.hs_count = htole32(3),
},
.fs_count = htole32(3),
.fs_descs = {
.intf = {
.bLength = sizeof(descriptors.fs_descs.intf),
Expand All @@ -59,6 +62,7 @@ static const struct {
.bmAttributes = USB_ENDPOINT_XFER_BULK,
},
},
.hs_count = htole32(3),
.hs_descs = {
.intf = {
.bLength = sizeof(descriptors.hs_descs.intf),
Expand Down

0 comments on commit 0ebe991

Please sign in to comment.