#include "uvc_configfs.h"
#include <linux/sort.h>
#include <linux/usb/uvc.h>
#include <linux/usb/video.h>
#define UVC_ATTR(prefix, cname, aname) …
#define UVC_ATTR_RO(prefix, cname, aname) …
#define le8_to_cpu(x) …
#define cpu_to_le8(x) …
static int uvcg_config_compare_u32(const void *l, const void *r)
{ … }
static inline int __uvcg_count_item_entries(char *buf, void *priv, unsigned int size)
{ … }
static inline int __uvcg_fill_item_entries(char *buf, void *priv, unsigned int size)
{ … }
static int __uvcg_iter_item_entries(const char *page, size_t len,
int (*fun)(char *, void *, unsigned int),
void *priv, unsigned int size)
{ … }
struct uvcg_config_group_type { … };
static void uvcg_config_item_release(struct config_item *item)
{ … }
static struct configfs_item_operations uvcg_config_item_ops = …;
static int uvcg_config_create_group(struct config_group *parent,
const struct uvcg_config_group_type *type);
static int uvcg_config_create_children(struct config_group *group,
const struct uvcg_config_group_type *type)
{ … }
static int uvcg_config_create_group(struct config_group *parent,
const struct uvcg_config_group_type *type)
{ … }
static void uvcg_config_remove_children(struct config_group *group)
{ … }
#define UVCG_CTRL_HDR_ATTR …
UVCG_CTRL_HDR_ATTR;
UVCG_CTRL_HDR_ATTR;
#undef UVCG_CTRL_HDR_ATTR
static struct configfs_attribute *uvcg_control_header_attrs[] = …;
static const struct config_item_type uvcg_control_header_type = …;
static struct config_item *uvcg_control_header_make(struct config_group *group,
const char *name)
{ … }
static struct configfs_group_operations uvcg_control_header_grp_ops = …;
static const struct uvcg_config_group_type uvcg_control_header_grp_type = …;
#define UVCG_DEFAULT_PROCESSING_ATTR …
UVCG_DEFAULT_PROCESSING_ATTR;
UVCG_DEFAULT_PROCESSING_ATTR;
UVCG_DEFAULT_PROCESSING_ATTR;
UVCG_DEFAULT_PROCESSING_ATTR;
#undef UVCG_DEFAULT_PROCESSING_ATTR
static ssize_t uvcg_default_processing_bm_controls_store(
struct config_item *item, const char *page, size_t len)
{ … }
static ssize_t uvcg_default_processing_bm_controls_show(
struct config_item *item, char *page)
{ … }
UVC_ATTR(…);
static struct configfs_attribute *uvcg_default_processing_attrs[] = …;
static const struct uvcg_config_group_type uvcg_default_processing_type = …;
static const struct uvcg_config_group_type uvcg_processing_grp_type = …;
#define UVCG_DEFAULT_CAMERA_ATTR …
UVCG_DEFAULT_CAMERA_ATTR;
UVCG_DEFAULT_CAMERA_ATTR;
UVCG_DEFAULT_CAMERA_ATTR;
UVCG_DEFAULT_CAMERA_ATTR;
UVCG_DEFAULT_CAMERA_ATTR;
UVCG_DEFAULT_CAMERA_ATTR;
UVCG_DEFAULT_CAMERA_ATTR;
#undef UVCG_DEFAULT_CAMERA_ATTR
static ssize_t uvcg_default_camera_bm_controls_store(
struct config_item *item, const char *page, size_t len)
{ … }
static ssize_t uvcg_default_camera_bm_controls_show(
struct config_item *item, char *page)
{ … }
UVC_ATTR(…);
static struct configfs_attribute *uvcg_default_camera_attrs[] = …;
static const struct uvcg_config_group_type uvcg_default_camera_type = …;
static const struct uvcg_config_group_type uvcg_camera_grp_type = …;
#define UVCG_DEFAULT_OUTPUT_ATTR …
UVCG_DEFAULT_OUTPUT_ATTR;
UVCG_DEFAULT_OUTPUT_ATTR;
UVCG_DEFAULT_OUTPUT_ATTR;
UVCG_DEFAULT_OUTPUT_ATTR;
#undef UVCG_DEFAULT_OUTPUT_ATTR
static ssize_t uvcg_default_output_b_source_id_show(struct config_item *item,
char *page)
{ … }
static ssize_t uvcg_default_output_b_source_id_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVC_ATTR(…);
static struct configfs_attribute *uvcg_default_output_attrs[] = …;
static const struct uvcg_config_group_type uvcg_default_output_type = …;
static const struct uvcg_config_group_type uvcg_output_grp_type = …;
static const struct uvcg_config_group_type uvcg_terminal_grp_type = …;
#define UVCG_EXTENSION_ATTR(cname, aname, ro...) …
UVCG_EXTENSION_ATTR(…);
UVCG_EXTENSION_ATTR(…);
UVCG_EXTENSION_ATTR(…);
static ssize_t uvcg_extension_b_num_controls_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVCG_EXTENSION_ATTR(…);
static ssize_t uvcg_extension_b_nr_in_pins_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVCG_EXTENSION_ATTR(…);
static ssize_t uvcg_extension_b_control_size_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVCG_EXTENSION_ATTR(…);
static ssize_t uvcg_extension_guid_extension_code_show(struct config_item *item,
char *page)
{ … }
static ssize_t uvcg_extension_guid_extension_code_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVC_ATTR(…);
static ssize_t uvcg_extension_ba_source_id_show(struct config_item *item,
char *page)
{ … }
static ssize_t uvcg_extension_ba_source_id_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVC_ATTR(…);
static ssize_t uvcg_extension_bm_controls_show(struct config_item *item,
char *page)
{ … }
static ssize_t uvcg_extension_bm_controls_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVC_ATTR(…);
static struct configfs_attribute *uvcg_extension_attrs[] = …;
static void uvcg_extension_release(struct config_item *item)
{ … }
static int uvcg_extension_allow_link(struct config_item *src, struct config_item *tgt)
{ … }
static void uvcg_extension_drop_link(struct config_item *src, struct config_item *tgt)
{ … }
static struct configfs_item_operations uvcg_extension_item_ops = …;
static const struct config_item_type uvcg_extension_type = …;
static void uvcg_extension_drop(struct config_group *group, struct config_item *item)
{ … }
static struct config_item *uvcg_extension_make(struct config_group *group, const char *name)
{ … }
static struct configfs_group_operations uvcg_extensions_grp_ops = …;
static const struct uvcg_config_group_type uvcg_extensions_grp_type = …;
struct uvcg_control_class_group { … };
static inline struct uvc_descriptor_header
**uvcg_get_ctl_class_arr(struct config_item *i, struct f_uvc_opts *o)
{ … }
static int uvcg_control_class_allow_link(struct config_item *src,
struct config_item *target)
{ … }
static void uvcg_control_class_drop_link(struct config_item *src,
struct config_item *target)
{ … }
static struct configfs_item_operations uvcg_control_class_item_ops = …;
static const struct config_item_type uvcg_control_class_type = …;
static int uvcg_control_class_create_children(struct config_group *parent)
{ … }
static const struct uvcg_config_group_type uvcg_control_class_grp_type = …;
static ssize_t uvcg_default_control_b_interface_number_show(
struct config_item *item, char *page)
{ … }
UVC_ATTR_RO(…);
static ssize_t uvcg_default_control_enable_interrupt_ep_show(
struct config_item *item, char *page)
{ … }
static ssize_t uvcg_default_control_enable_interrupt_ep_store(
struct config_item *item, const char *page, size_t len)
{ … }
UVC_ATTR(…);
static struct configfs_attribute *uvcg_default_control_attrs[] = …;
static const struct uvcg_config_group_type uvcg_control_grp_type = …;
static const char * const uvcg_format_names[] = …;
static struct uvcg_color_matching *
uvcg_format_get_default_color_match(struct config_item *streaming)
{ … }
static int uvcg_format_allow_link(struct config_item *src, struct config_item *tgt)
{ … }
static void uvcg_format_drop_link(struct config_item *src, struct config_item *tgt)
{ … }
static struct configfs_item_operations uvcg_format_item_operations = …;
static ssize_t uvcg_format_bma_controls_show(struct uvcg_format *f, char *page)
{ … }
static ssize_t uvcg_format_bma_controls_store(struct uvcg_format *ch,
const char *page, size_t len)
{ … }
static void uvcg_format_set_indices(struct config_group *fmt);
static int uvcg_streaming_header_allow_link(struct config_item *src,
struct config_item *target)
{ … }
static void uvcg_streaming_header_drop_link(struct config_item *src,
struct config_item *target)
{ … }
static struct configfs_item_operations uvcg_streaming_header_item_ops = …;
#define UVCG_STREAMING_HEADER_ATTR …
UVCG_STREAMING_HEADER_ATTR;
UVCG_STREAMING_HEADER_ATTR;
UVCG_STREAMING_HEADER_ATTR;
UVCG_STREAMING_HEADER_ATTR;
UVCG_STREAMING_HEADER_ATTR;
#undef UVCG_STREAMING_HEADER_ATTR
static struct configfs_attribute *uvcg_streaming_header_attrs[] = …;
static const struct config_item_type uvcg_streaming_header_type = …;
static struct config_item
*uvcg_streaming_header_make(struct config_group *group, const char *name)
{ … }
static struct configfs_group_operations uvcg_streaming_header_grp_ops = …;
static const struct uvcg_config_group_type uvcg_streaming_header_grp_type = …;
#define UVCG_FRAME_ATTR …
static ssize_t uvcg_frame_b_frame_index_show(struct config_item *item,
char *page)
{ … }
UVC_ATTR_RO(…);
UVCG_FRAME_ATTR(bm_capabilities, bmCapabilities, 8);
UVCG_FRAME_ATTR(w_width, wWidth, 16);
UVCG_FRAME_ATTR(w_height, wHeight, 16);
UVCG_FRAME_ATTR(dw_min_bit_rate, dwMinBitRate, 32);
UVCG_FRAME_ATTR(dw_max_bit_rate, dwMaxBitRate, 32);
UVCG_FRAME_ATTR(dw_max_video_frame_buffer_size, dwMaxVideoFrameBufferSize, 32);
UVCG_FRAME_ATTR(dw_default_frame_interval, dwDefaultFrameInterval, 32);
#undef UVCG_FRAME_ATTR
static ssize_t uvcg_frame_dw_frame_interval_show(struct config_item *item,
char *page)
{ … }
static ssize_t uvcg_frame_dw_frame_interval_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVC_ATTR(…);
static struct configfs_attribute *uvcg_frame_attrs[] = …;
static const struct config_item_type uvcg_frame_type = …;
static struct config_item *uvcg_frame_make(struct config_group *group,
const char *name)
{ … }
static void uvcg_frame_drop(struct config_group *group, struct config_item *item)
{ … }
static void uvcg_format_set_indices(struct config_group *fmt)
{ … }
static struct configfs_group_operations uvcg_uncompressed_group_ops = …;
static ssize_t uvcg_uncompressed_guid_format_show(struct config_item *item,
char *page)
{ … }
static ssize_t uvcg_uncompressed_guid_format_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVC_ATTR(…);
#define UVCG_UNCOMPRESSED_ATTR_RO …
#define UVCG_UNCOMPRESSED_ATTR …
UVCG_UNCOMPRESSED_ATTR_RO(b_format_index, bFormatIndex, 8);
UVCG_UNCOMPRESSED_ATTR(b_bits_per_pixel, bBitsPerPixel, 8);
UVCG_UNCOMPRESSED_ATTR(b_default_frame_index, bDefaultFrameIndex, 8);
UVCG_UNCOMPRESSED_ATTR_RO(b_aspect_ratio_x, bAspectRatioX, 8);
UVCG_UNCOMPRESSED_ATTR_RO(b_aspect_ratio_y, bAspectRatioY, 8);
UVCG_UNCOMPRESSED_ATTR_RO(bm_interlace_flags, bmInterlaceFlags, 8);
#undef UVCG_UNCOMPRESSED_ATTR
#undef UVCG_UNCOMPRESSED_ATTR_RO
static inline ssize_t
uvcg_uncompressed_bma_controls_show(struct config_item *item, char *page)
{ … }
static inline ssize_t
uvcg_uncompressed_bma_controls_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVC_ATTR(…);
static struct configfs_attribute *uvcg_uncompressed_attrs[] = …;
static const struct config_item_type uvcg_uncompressed_type = …;
static struct config_group *uvcg_uncompressed_make(struct config_group *group,
const char *name)
{ … }
static struct configfs_group_operations uvcg_uncompressed_grp_ops = …;
static const struct uvcg_config_group_type uvcg_uncompressed_grp_type = …;
static struct configfs_group_operations uvcg_mjpeg_group_ops = …;
#define UVCG_MJPEG_ATTR_RO …
#define UVCG_MJPEG_ATTR …
UVCG_MJPEG_ATTR_RO;
UVCG_MJPEG_ATTR;
UVCG_MJPEG_ATTR_RO;
UVCG_MJPEG_ATTR_RO;
UVCG_MJPEG_ATTR_RO;
UVCG_MJPEG_ATTR_RO;
#undef UVCG_MJPEG_ATTR
#undef UVCG_MJPEG_ATTR_RO
static inline ssize_t
uvcg_mjpeg_bma_controls_show(struct config_item *item, char *page)
{ … }
static inline ssize_t
uvcg_mjpeg_bma_controls_store(struct config_item *item,
const char *page, size_t len)
{ … }
UVC_ATTR(…);
static struct configfs_attribute *uvcg_mjpeg_attrs[] = …;
static const struct config_item_type uvcg_mjpeg_type = …;
static struct config_group *uvcg_mjpeg_make(struct config_group *group,
const char *name)
{ … }
static struct configfs_group_operations uvcg_mjpeg_grp_ops = …;
static const struct uvcg_config_group_type uvcg_mjpeg_grp_type = …;
#define UVCG_COLOR_MATCHING_ATTR …
UVCG_COLOR_MATCHING_ATTR;
UVCG_COLOR_MATCHING_ATTR;
UVCG_COLOR_MATCHING_ATTR;
#undef UVCG_COLOR_MATCHING_ATTR
static struct configfs_attribute *uvcg_color_matching_attrs[] = …;
static void uvcg_color_matching_release(struct config_item *item)
{ … }
static struct configfs_item_operations uvcg_color_matching_item_ops = …;
static const struct config_item_type uvcg_color_matching_type = …;
static struct config_group *uvcg_color_matching_make(struct config_group *group,
const char *name)
{ … }
static struct configfs_group_operations uvcg_color_matching_grp_group_ops = …;
static int uvcg_color_matching_create_children(struct config_group *parent)
{ … }
static const struct uvcg_config_group_type uvcg_color_matching_grp_type = …;
struct uvcg_streaming_class_group { … };
static inline struct uvc_descriptor_header
***__uvcg_get_stream_class_arr(struct config_item *i, struct f_uvc_opts *o)
{ … }
enum uvcg_strm_type { … };
static int __uvcg_iter_strm_cls(struct uvcg_streaming_header *h,
void *priv2, void *priv3,
int (*fun)(void *, void *, void *, int, enum uvcg_strm_type type))
{ … }
static int __uvcg_cnt_strm(void *priv1, void *priv2, void *priv3, int n,
enum uvcg_strm_type type)
{ … }
static int __uvcg_fill_strm(void *priv1, void *priv2, void *priv3, int n,
enum uvcg_strm_type type)
{ … }
static int uvcg_streaming_class_allow_link(struct config_item *src,
struct config_item *target)
{ … }
static void uvcg_streaming_class_drop_link(struct config_item *src,
struct config_item *target)
{ … }
static struct configfs_item_operations uvcg_streaming_class_item_ops = …;
static const struct config_item_type uvcg_streaming_class_type = …;
static int uvcg_streaming_class_create_children(struct config_group *parent)
{ … }
static const struct uvcg_config_group_type uvcg_streaming_class_grp_type = …;
static ssize_t uvcg_default_streaming_b_interface_number_show(
struct config_item *item, char *page)
{ … }
UVC_ATTR_RO(…);
static struct configfs_attribute *uvcg_default_streaming_attrs[] = …;
static const struct uvcg_config_group_type uvcg_streaming_grp_type = …;
static void uvc_func_item_release(struct config_item *item)
{ … }
static int uvc_func_allow_link(struct config_item *src, struct config_item *tgt)
{ … }
static void uvc_func_drop_link(struct config_item *src, struct config_item *tgt)
{ … }
static struct configfs_item_operations uvc_func_item_ops = …;
#define UVCG_OPTS_ATTR …
UVCG_OPTS_ATTR;
UVCG_OPTS_ATTR;
UVCG_OPTS_ATTR;
#undef UVCG_OPTS_ATTR
#define UVCG_OPTS_STRING_ATTR …
UVCG_OPTS_STRING_ATTR;
#undef UVCG_OPTS_STRING_ATTR
static struct configfs_attribute *uvc_attrs[] = …;
static const struct uvcg_config_group_type uvc_func_type = …;
int uvcg_attach_configfs(struct f_uvc_opts *opts)
{ … }