summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/gspca/t613.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/gspca/t613.c')
-rw-r--r--linux/drivers/media/video/gspca/t613.c253
1 files changed, 145 insertions, 108 deletions
diff --git a/linux/drivers/media/video/gspca/t613.c b/linux/drivers/media/video/gspca/t613.c
index 6393b96fd..78ee480e2 100644
--- a/linux/drivers/media/video/gspca/t613.c
+++ b/linux/drivers/media/video/gspca/t613.c
@@ -26,13 +26,8 @@
#define MODULE_NAME "t613"
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
-
-struct control_menu_info {
- int value;
- char name[32];
-};
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
#define MAX_GAMMA 0x10 /* 0 to 15 */
@@ -227,32 +222,49 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct control_menu_info effects_control[] = {
- {0, "Normal"},
- {1, "Emboss"}, /* disabled */
- {2, "Monochrome"},
- {3, "Sepia"},
- {4, "Sketch"},
- {5, "Sun Effect"}, /* disabled */
- {6, "Negative"},
+static char *effects_control[] = {
+ "Normal",
+ "Emboss", /* disabled */
+ "Monochrome",
+ "Sepia",
+ "Sketch",
+ "Sun Effect", /* disabled */
+ "Negative",
};
-#define NUM_EFFECTS_CONTROL \
- (sizeof(effects_control)/sizeof(effects_control[0]))
-
-static struct cam_mode vga_mode_t16[] = {
- {V4L2_PIX_FMT_JPEG, 160, 120, 4},
- {V4L2_PIX_FMT_JPEG, 176, 144, 3},
- {V4L2_PIX_FMT_JPEG, 320, 240, 2},
- {V4L2_PIX_FMT_JPEG, 352, 288, 1},
- {V4L2_PIX_FMT_JPEG, 640, 480, 0},
+static struct v4l2_pix_format vga_mode_t16[] = {
+ {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 160,
+ .sizeimage = 160 * 120 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 4},
+ {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 3},
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 2},
+ {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
#define T16_OFFSET_DATA 631
#define MAX_EFFECTS 7
/* easily done by soft, this table could be removed,
* i keep it here just in case */
-unsigned char effects_table[MAX_EFFECTS][6] = {
+static const __u8 effects_table[MAX_EFFECTS][6] = {
{0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x00}, /* Normal */
{0xa8, 0xc8, 0xc6, 0x52, 0xc0, 0x04}, /* Repujar */
{0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x20}, /* Monochrome */
@@ -262,7 +274,7 @@ unsigned char effects_table[MAX_EFFECTS][6] = {
{0xa8, 0xc8, 0xc6, 0xd2, 0xc0, 0x40}, /* Negative */
};
-unsigned char gamma_table[MAX_GAMMA][34] = {
+static const __u8 gamma_table[MAX_GAMMA][34] = {
{0x90, 0x00, 0x91, 0x3e, 0x92, 0x69, 0x93, 0x85,
0x94, 0x95, 0x95, 0xa1, 0x96, 0xae, 0x97, 0xb9,
0x98, 0xc2, 0x99, 0xcb, 0x9a, 0xd4, 0x9b, 0xdb,
@@ -345,7 +357,7 @@ unsigned char gamma_table[MAX_GAMMA][34] = {
0xA0, 0xFF}
};
-static __u8 tas5130a_sensor_init[][8] = {
+static const __u8 tas5130a_sensor_init[][8] = {
{0x62, 0x08, 0x63, 0x70, 0x64, 0x1d, 0x60, 0x09},
{0x62, 0x20, 0x63, 0x01, 0x64, 0x02, 0x60, 0x09},
{0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09},
@@ -366,13 +378,41 @@ static void t16RegRead(struct usb_device *dev,
static void t16RegWrite(struct usb_device *dev,
__u16 value,
- __u16 index, __u8 *buffer, __u16 length)
+ __u16 index,
+ const __u8 *buffer, __u16 len)
{
- usb_control_msg(dev,
- usb_sndctrlpipe(dev, 0),
- 0, /* request */
- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- value, index, buffer, length, 500);
+ if (buffer == NULL) {
+ usb_control_msg(dev,
+ usb_sndctrlpipe(dev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+ value, index,
+ NULL, 0, 500);
+ return;
+ }
+ if (len < 16) {
+ __u8 tmpbuf[16];
+
+ memcpy(tmpbuf, buffer, len);
+ usb_control_msg(dev,
+ usb_sndctrlpipe(dev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+ value, index,
+ tmpbuf, len, 500);
+ } else {
+ __u8 *tmpbuf;
+
+ tmpbuf = kmalloc(len, GFP_KERNEL);
+ memcpy(tmpbuf, buffer, len);
+ usb_control_msg(dev,
+ usb_sndctrlpipe(dev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+ value, index,
+ tmpbuf, len, 500);
+ kfree(tmpbuf);
+ }
}
/* this function is called at probe time */
@@ -425,18 +465,18 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
int i = 0;
__u8 test_byte;
- static unsigned char read_indexs[] =
+ static const __u8 read_indexs[] =
{ 0x06, 0x07, 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5,
0xa6, 0xa8, 0xbb, 0xbc, 0xc6, 0x00, 0x00 };
- static unsigned char n1[6] =
+ static const __u8 n1[6] =
{0x08, 0x03, 0x09, 0x03, 0x12, 0x04};
- static unsigned char n2[2] =
+ static const __u8 n2[2] =
{0x08, 0x00};
- static unsigned char nset[6] =
+ static const __u8 nset[6] =
{ 0x61, 0x68, 0x62, 0xff, 0x60, 0x07 };
- static unsigned char n3[6] =
+ static const __u8 n3[6] =
{0x61, 0x68, 0x65, 0x0a, 0x60, 0x04};
- static unsigned char n4[0x46] =
+ static const __u8 n4[0x46] =
{0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c,
0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68,
0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1,
@@ -447,7 +487,7 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40,
0xac, 0x84, 0xad, 0x86, 0xaf, 0x46};
#if 0
- static unsigned char nset1[50] = {
+ static const __u8 nset1[50] = {
0x80, 0x3c, 0x81, 0x68, 0x83, 0xa0, 0x84, 0x20, 0x8a, 0x5c,
0x8b, 0x4c, 0x8c, 0x88, 0x8e, 0xb4,
0x8f, 0x24, 0xa1, 0xb1, 0xa2, 0x30, 0xa5, 0x18, 0xa6, 0x4a,
@@ -457,40 +497,40 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
0xc6, 0xd2
};
#endif
- static unsigned char nset4[18] = {
+ static const __u8 nset4[18] = {
0xe0, 0x60, 0xe1, 0xa8, 0xe2, 0xe0, 0xe3, 0x60, 0xe4, 0xa8,
0xe5, 0xe0, 0xe6, 0x60, 0xe7, 0xa8,
0xe8, 0xe0
};
/* ojo puede ser 0xe6 en vez de 0xe9 */
- static unsigned char nset2[20] = {
+ static const __u8 nset2[20] = {
0xd0, 0xbb, 0xd1, 0x28, 0xd2, 0x10, 0xd3, 0x10, 0xd4, 0xbb,
0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27,
0xd8, 0xc8, 0xd9, 0xfc
};
- static unsigned char missing[8] =
+ static const __u8 missing[8] =
{ 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
- static unsigned char nset3[18] = {
+ static const __u8 nset3[18] = {
0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, 0xcb, 0xa8,
0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8,
0xcf, 0xe0
};
- static unsigned char nset5[4] =
+ static const __u8 nset5[4] =
{ 0x8f, 0x24, 0xc3, 0x00 }; /* bright */
- static unsigned char nset6[34] = {
+ static const __u8 nset6[34] = {
0x90, 0x00, 0x91, 0x1c, 0x92, 0x30, 0x93, 0x43, 0x94, 0x54,
0x95, 0x65, 0x96, 0x75, 0x97, 0x84,
0x98, 0x93, 0x99, 0xa1, 0x9a, 0xb0, 0x9b, 0xbd, 0x9c, 0xca,
0x9d, 0xd8, 0x9e, 0xe5, 0x9f, 0xf2,
0xa0, 0xff
}; /* Gamma */
- static unsigned char nset7[4] =
+ static const __u8 nset7[4] =
{ 0x66, 0xca, 0xa8, 0xf8 }; /* 50/60 Hz */
- static unsigned char nset9[4] =
+ static const __u8 nset9[4] =
{ 0x0b, 0x04, 0x0a, 0x78 };
- static unsigned char nset8[6] =
+ static const __u8 nset8[6] =
{ 0xa8, 0xf0, 0xc6, 0x88, 0xc0, 0x00 };
- static unsigned char nset10[6] =
+ static const __u8 nset10[6] =
{ 0x0c, 0x03, 0xab, 0x10, 0x81, 0x20 };
t16RegWrite(dev, 0x01, 0x0000, n1, 0x06);
@@ -508,31 +548,31 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
t16RegWrite(dev, 0x01, 0x0000, n3, 0x06);
t16RegWrite(dev, 0x01, 0x0000, n4, 0x46);
t16RegRead(dev, 0x0080, &test_byte, 1);
- t16RegWrite(dev, 0x00, 0x2c80, 0x00, 0x0);
+ t16RegWrite(dev, 0x00, 0x2c80, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
- t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0);
- t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0);
- t16RegWrite(dev, 0x00, 0x338e, 0x00, 0x0);
- t16RegWrite(dev, 0x01, 00, nset5, 0x04);
- t16RegWrite(dev, 0x00, 0x00a9, 0x00, 0x0);
- t16RegWrite(dev, 0x01, 00, nset6, 0x22);
- t16RegWrite(dev, 0x00, 0x86bb, 0x00, 0x0);
- t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x0);
-
- t16RegWrite(dev, 0x01, 00, missing, 0x08);
-
- t16RegWrite(dev, 0x00, 0x2087, 0x00, 0x0);
- t16RegWrite(dev, 0x00, 0x2088, 0x00, 0x0);
- t16RegWrite(dev, 0x00, 0x2089, 0x00, 0x0);
-
- t16RegWrite(dev, 0x01, 00, nset7, 0x4);
- t16RegWrite(dev, 0x01, 00, nset10, 0x06);
- t16RegWrite(dev, 0x01, 00, nset8, 0x06);
- t16RegWrite(dev, 0x01, 00, nset9, 0x04);
-
- t16RegWrite(dev, 0x00, 0x2880, 0x00, 0x0);
+ t16RegWrite(dev, 0x00, 0x3880, NULL, 0);
+ t16RegWrite(dev, 0x00, 0x3880, NULL, 0);
+ t16RegWrite(dev, 0x00, 0x338e, NULL, 0);
+ t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04);
+ t16RegWrite(dev, 0x00, 0x00a9, NULL, 0);
+ t16RegWrite(dev, 0x01, 0x0000, nset6, 0x22);
+ t16RegWrite(dev, 0x00, 0x86bb, NULL, 0);
+ t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0);
+
+ t16RegWrite(dev, 0x01, 0x0000, missing, 0x08);
+
+ t16RegWrite(dev, 0x00, 0x2087, NULL, 0);
+ t16RegWrite(dev, 0x00, 0x2088, NULL, 0);
+ t16RegWrite(dev, 0x00, 0x2089, NULL, 0);
+
+ t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04);
+ t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06);
+ t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06);
+ t16RegWrite(dev, 0x01, 0x0000, nset9, 0x04);
+
+ t16RegWrite(dev, 0x00, 0x2880, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
@@ -545,7 +585,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
unsigned int brightness;
- unsigned char set6[4] = { 0x8f, 0x26, 0xc3, 0x80 };
+ __u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x80 };
brightness = sd->brightness;
if (brightness < 7) {
@@ -563,7 +603,7 @@ static void setflip(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- unsigned char flipcmd[8] =
+ __u8 flipcmd[8] =
{ 0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09 };
if (sd->mirror == 1)
@@ -585,9 +625,9 @@ static void seteffect(struct gspca_dev *gspca_dev)
}
if (sd->effect == 1 || sd->effect == 4)
- t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0);
else
- t16RegWrite(dev, 0x00, 0xfaa6, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, 0xfaa6, NULL, 0);
}
static void setwhitebalance(struct gspca_dev *gspca_dev)
@@ -595,7 +635,7 @@ static void setwhitebalance(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- unsigned char white_balance[8] =
+ __u8 white_balance[8] =
{ 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
if (sd->whitebalance == 1)
@@ -628,18 +668,17 @@ static void setcontrast(struct gspca_dev *gspca_dev)
else
reg_to_write = (0x00a9 + ((contrast - 7) * 0x200));
- t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0);
-
+ t16RegWrite(dev, 0x00, reg_to_write, NULL, 0);
}
static void setcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- __u16 reg_to_write = 0x00;
+ __u16 reg_to_write;
reg_to_write = 0xc0bb + sd->colors * 0x100;
- t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0);
+ t16RegWrite(dev, 0x00, reg_to_write, NULL, 0);
}
static void setgamma(struct gspca_dev *gspca_dev)
@@ -658,11 +697,11 @@ static void setsharpness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- __u16 reg_to_write = 0x00;
+ __u16 reg_to_write;
reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness;
- t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, reg_to_write, NULL, 0);
}
static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
@@ -678,6 +717,7 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
{
struct sd *sd = (struct sd *) gspca_dev;
+
*val = sd->brightness;
return *val;
}
@@ -700,7 +740,6 @@ static int sd_getwhitebalance(struct gspca_dev *gspca_dev, __s32 *val)
return *val;
}
-
static int sd_setflip(struct gspca_dev *gspca_dev, __s32 val)
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -834,9 +873,9 @@ static int sd_setlowlight(struct gspca_dev *gspca_dev, __s32 val)
sd->autogain = val;
if (val != 0)
- t16RegWrite(dev, 0x00, 0xf48e, 0x00, 0);
+ t16RegWrite(dev, 0x00, 0xf48e, NULL, 0);
else
- t16RegWrite(dev, 0x00, 0xb48e, 0x00, 0);
+ t16RegWrite(dev, 0x00, 0xb48e, NULL, 0);
return 0;
}
@@ -854,14 +893,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
int mode;
__u8 test_byte;
- static __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 };
+ static const __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 };
__u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 };
- static __u8 t3[] =
+ static const __u8 t3[] =
{ 0xb3, 0x07, 0xb4, 0x00, 0xb5, 0x88, 0xb6, 0x02, 0xb7, 0x06,
0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 };
- static __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 };
+ static const __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 };
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. mode;
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. priv;
switch (mode) {
case 1: /* 352x288 */
t2[1] = 0x40;
@@ -883,16 +922,16 @@ static void sd_start(struct gspca_dev *gspca_dev)
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8);
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8);
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8);
- t16RegWrite(dev, 0x00, 0x3c80, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, 0x3c80, NULL, 0);
/* just in case and to keep sync with logs (for mine) */
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8);
- t16RegWrite(dev, 0x00, 0x3c80, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, 0x3c80, NULL, 0);
/* just in case and to keep sync with logs (for mine) */
t16RegWrite(dev, 0x01, 0x0000, t1, 4);
t16RegWrite(dev, 0x01, 0x0000, t2, 6);
- t16RegRead(dev, 0x0012, &test_byte, 0x1);
+ t16RegRead(dev, 0x0012, &test_byte, 0x01);
t16RegWrite(dev, 0x01, 0x0000, t3, 0x10);
- t16RegWrite(dev, 0x00, 0x0013, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, 0x0013, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, t4, 0x4);
/* restart on each start, just in case, sometimes regs goes wrong
* when using controls from app */
@@ -919,11 +958,11 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
int sof = 0;
- static unsigned char ffd9[] = { 0xff, 0xd9 };
+ static __u8 ffd9[] = { 0xff, 0xd9 };
if (data[0] == 0x5a) {
/* Control Packet, after this came the header again,
@@ -962,27 +1001,26 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
static int sd_querymenu(struct gspca_dev *gspca_dev,
struct v4l2_querymenu *menu)
{
- memset(menu->name, 0, sizeof menu->name);
-
switch (menu->id) {
case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) {
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
- strcpy(menu->name, "50 Hz");
+ strcpy((char *) menu->name, "50 Hz");
return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
- strcpy(menu->name, "60 Hz");
+ strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
case V4L2_CID_EFFECTS:
- if (menu->index < 0 || menu->index >= NUM_EFFECTS_CONTROL)
- return -EINVAL;
- strncpy((char *) menu->name,
- effects_control[menu->index].name, 32);
+ if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) {
+ strncpy((char *) menu->name,
+ effects_control[menu->index], 32);
+ return 0;
+ }
break;
}
- return 0;
+ return -EINVAL;
}
/* this function is called at open time */
@@ -993,7 +1031,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -1009,11 +1047,10 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x17a1, 0x0128), DVNM("XPX Webcam")},
{}
};
-
MODULE_DEVICE_TABLE(usb, device_table);
/* -- device connect -- */