#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/completion.h>
#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/printk.h>
#include <linux/input.h>
#include <linux/input/mt.h>
#include <linux/usb/input.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-dev.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-ctrls.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-dma-sg.h>
struct sur40_header { … } __packed;
struct sur40_blob { … } __packed;
struct sur40_data { … } __packed;
struct sur40_image_header { … } __packed;
#define DRIVER_SHORT …
#define DRIVER_LONG …
#define DRIVER_AUTHOR …
#define DRIVER_DESC …
#define ID_MICROSOFT …
#define ID_SUR40 …
#define SENSOR_RES_X …
#define SENSOR_RES_Y …
#define TOUCH_ENDPOINT …
#define VIDEO_ENDPOINT …
#define VIDEO_HEADER_MAGIC …
#define VIDEO_PACKET_SIZE …
#define POLL_INTERVAL …
#define MAX_CONTACTS …
#define SUR40_GET_VERSION …
#define SUR40_ACCEL_CAPS …
#define SUR40_SENSOR_CAPS …
#define SUR40_POKE …
#define SUR40_PEEK …
#define SUR40_GET_STATE …
#define SUR40_GET_SENSORS …
#define SUR40_BLOB …
#define SUR40_TOUCH …
#define SUR40_TAG …
#define SUR40_BRIGHTNESS_MAX …
#define SUR40_BRIGHTNESS_MIN …
#define SUR40_BRIGHTNESS_DEF …
#define SUR40_CONTRAST_MAX …
#define SUR40_CONTRAST_MIN …
#define SUR40_CONTRAST_DEF …
#define SUR40_GAIN_MAX …
#define SUR40_GAIN_MIN …
#define SUR40_GAIN_DEF …
#define SUR40_BACKLIGHT_MAX …
#define SUR40_BACKLIGHT_MIN …
#define SUR40_BACKLIGHT_DEF …
#define sur40_str(s) …
#define SUR40_PARAM_RANGE(lo, hi) …
static uint brightness = …;
module_param(brightness, uint, 0644);
MODULE_PARM_DESC(…) …;
static uint contrast = …;
module_param(contrast, uint, 0644);
MODULE_PARM_DESC(…) …;
static uint gain = …;
module_param(gain, uint, 0644);
MODULE_PARM_DESC(…) …;
static const struct v4l2_pix_format sur40_pix_format[] = …;
struct sur40_state { … };
struct sur40_buffer { … };
static const struct video_device sur40_video_device;
static const struct vb2_queue sur40_queue;
static void sur40_process_video(struct sur40_state *sur40);
static int sur40_s_ctrl(struct v4l2_ctrl *ctrl);
static const struct v4l2_ctrl_ops sur40_ctrl_ops = …;
static int sur40_command(struct sur40_state *dev,
u8 command, u16 index, void *buffer, u16 size)
{ … }
static int sur40_poke(struct sur40_state *dev, u8 offset, u8 value)
{ … }
static int sur40_set_preprocessor(struct sur40_state *dev, u8 value)
{ … }
static void sur40_set_vsvideo(struct sur40_state *handle, u8 value)
{ … }
static void sur40_set_irlevel(struct sur40_state *handle, u8 value)
{ … }
static int sur40_init(struct sur40_state *dev)
{ … }
static int sur40_open(struct input_dev *input)
{ … }
static void sur40_close(struct input_dev *input)
{ … }
static void sur40_report_blob(struct sur40_blob *blob, struct input_dev *input)
{ … }
static void sur40_poll(struct input_dev *input)
{ … }
static void sur40_process_video(struct sur40_state *sur40)
{ … }
static int sur40_input_setup_events(struct input_dev *input_dev)
{ … }
static int sur40_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{ … }
static void sur40_disconnect(struct usb_interface *interface)
{ … }
static int sur40_queue_setup(struct vb2_queue *q,
unsigned int *nbuffers, unsigned int *nplanes,
unsigned int sizes[], struct device *alloc_devs[])
{ … }
static int sur40_buffer_prepare(struct vb2_buffer *vb)
{ … }
static void sur40_buffer_queue(struct vb2_buffer *vb)
{ … }
static void return_all_buffers(struct sur40_state *sur40,
enum vb2_buffer_state state)
{ … }
static int sur40_start_streaming(struct vb2_queue *vq, unsigned int count)
{ … }
static void sur40_stop_streaming(struct vb2_queue *vq)
{ … }
static int sur40_vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{ … }
static int sur40_vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *i)
{ … }
static int sur40_vidioc_s_input(struct file *file, void *priv, unsigned int i)
{ … }
static int sur40_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
{ … }
static int sur40_vidioc_try_fmt(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int sur40_vidioc_s_fmt(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int sur40_vidioc_g_fmt(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int sur40_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static int sur40_ioctl_parm(struct file *file, void *priv,
struct v4l2_streamparm *p)
{ … }
static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{ … }
static int sur40_vidioc_enum_framesizes(struct file *file, void *priv,
struct v4l2_frmsizeenum *f)
{ … }
static int sur40_vidioc_enum_frameintervals(struct file *file, void *priv,
struct v4l2_frmivalenum *f)
{ … }
static const struct usb_device_id sur40_table[] = …;
MODULE_DEVICE_TABLE(usb, sur40_table);
static const struct vb2_ops sur40_queue_ops = …;
static const struct vb2_queue sur40_queue = …;
static const struct v4l2_file_operations sur40_video_fops = …;
static const struct v4l2_ioctl_ops sur40_video_ioctl_ops = …;
static const struct video_device sur40_video_device = …;
static struct usb_driver sur40_driver = …;
module_usb_driver(…) …;
MODULE_AUTHOR(…);
MODULE_DESCRIPTION(…);
MODULE_LICENSE(…) …;