patch-2.4.21 linux-2.4.21/drivers/usb/ibmcam.c
Next file: linux-2.4.21/drivers/usb/kaweth.c
Previous file: linux-2.4.21/drivers/usb/hub.c
Back to the patch index
Back to the overall index
- Lines: 452
- Date:
2003-06-13 07:51:36.000000000 -0700
- Orig file:
linux-2.4.20/drivers/usb/ibmcam.c
- Orig date:
2002-08-02 17:39:45.000000000 -0700
diff -urN linux-2.4.20/drivers/usb/ibmcam.c linux-2.4.21/drivers/usb/ibmcam.c
@@ -78,7 +78,7 @@
};
/*
- * This structure lives in uvd_t->user field.
+ * This structure lives in uvd->user field.
*/
typedef struct {
int initialized; /* Had we already sent init sequence? */
@@ -87,7 +87,7 @@
} ibmcam_t;
#define IBMCAM_T(uvd) ((ibmcam_t *)((uvd)->user_data))
-usbvideo_t *cams = NULL;
+struct usbvideo *cams = NULL;
static int debug = 0;
@@ -249,9 +249,9 @@
* History:
* 1/21/00 Created.
*/
-static ParseState_t ibmcam_find_header(uvd_t *uvd) /* FIXME: Add frame here */
+static enum ParseState ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame here */
{
- usbvideo_frame_t *frame;
+ struct usbvideo_frame *frame;
ibmcam_t *icam;
if ((uvd->curframe) < 0 || (uvd->curframe >= USBVIDEO_NUMFRAMES)) {
@@ -397,9 +397,9 @@
* 21-Jan-2000 Created.
* 12-Oct-2000 Reworked to reflect interlaced nature of the data.
*/
-static ParseState_t ibmcam_parse_lines(
- uvd_t *uvd,
- usbvideo_frame_t *frame,
+static enum ParseState ibmcam_parse_lines(
+ struct uvd *uvd,
+ struct usbvideo_frame *frame,
long *pcopylen)
{
unsigned char *f;
@@ -662,9 +662,9 @@
* them both as R component in attempt to at least partially recover the
* lost resolution.
*/
-static ParseState_t ibmcam_model2_320x240_parse_lines(
- uvd_t *uvd,
- usbvideo_frame_t *frame,
+static enum ParseState ibmcam_model2_320x240_parse_lines(
+ struct uvd *uvd,
+ struct usbvideo_frame *frame,
long *pcopylen)
{
unsigned char *f, *la, *lb;
@@ -816,9 +816,9 @@
return scan_Continue;
}
-static ParseState_t ibmcam_model3_parse_lines(
- uvd_t *uvd,
- usbvideo_frame_t *frame,
+static enum ParseState ibmcam_model3_parse_lines(
+ struct uvd *uvd,
+ struct usbvideo_frame *frame,
long *pcopylen)
{
unsigned char *data;
@@ -961,9 +961,9 @@
* History:
* 10-Feb-2001 Created.
*/
-static ParseState_t ibmcam_model4_128x96_parse_lines(
- uvd_t *uvd,
- usbvideo_frame_t *frame,
+static enum ParseState ibmcam_model4_128x96_parse_lines(
+ struct uvd *uvd,
+ struct usbvideo_frame *frame,
long *pcopylen)
{
const unsigned char *data_rv, *data_gv, *data_bv;
@@ -1049,9 +1049,9 @@
* History:
* 1/21/00 Created.
*/
-void ibmcam_ProcessIsocData(uvd_t *uvd, usbvideo_frame_t *frame)
+void ibmcam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame)
{
- ParseState_t newstate;
+ enum ParseState newstate;
long copylen = 0;
int mod = IBMCAM_T(uvd)->camera_model;
@@ -1128,7 +1128,7 @@
* 1/27/00 Added check for dev == NULL; this happens if camera is unplugged.
*/
static int ibmcam_veio(
- uvd_t *uvd,
+ struct uvd *uvd,
unsigned char req,
unsigned short value,
unsigned short index)
@@ -1195,7 +1195,7 @@
* History:
* 1/18/00 Created.
*/
-static int ibmcam_calculate_fps(uvd_t *uvd)
+static int ibmcam_calculate_fps(struct uvd *uvd)
{
return 3 + framerate*4 + framerate/2;
}
@@ -1209,33 +1209,33 @@
* History:
* 1/2/00 Created.
*/
-static void ibmcam_send_FF_04_02(uvd_t *uvd)
+static void ibmcam_send_FF_04_02(struct uvd *uvd)
{
ibmcam_veio(uvd, 0, 0x00FF, 0x0127);
ibmcam_veio(uvd, 0, 0x0004, 0x0124);
ibmcam_veio(uvd, 0, 0x0002, 0x0124);
}
-static void ibmcam_send_00_04_06(uvd_t *uvd)
+static void ibmcam_send_00_04_06(struct uvd *uvd)
{
ibmcam_veio(uvd, 0, 0x0000, 0x0127);
ibmcam_veio(uvd, 0, 0x0004, 0x0124);
ibmcam_veio(uvd, 0, 0x0006, 0x0124);
}
-static void ibmcam_send_x_00(uvd_t *uvd, unsigned short x)
+static void ibmcam_send_x_00(struct uvd *uvd, unsigned short x)
{
ibmcam_veio(uvd, 0, x, 0x0127);
ibmcam_veio(uvd, 0, 0x0000, 0x0124);
}
-static void ibmcam_send_x_00_05(uvd_t *uvd, unsigned short x)
+static void ibmcam_send_x_00_05(struct uvd *uvd, unsigned short x)
{
ibmcam_send_x_00(uvd, x);
ibmcam_veio(uvd, 0, 0x0005, 0x0124);
}
-static void ibmcam_send_x_00_05_02(uvd_t *uvd, unsigned short x)
+static void ibmcam_send_x_00_05_02(struct uvd *uvd, unsigned short x)
{
ibmcam_veio(uvd, 0, x, 0x0127);
ibmcam_veio(uvd, 0, 0x0000, 0x0124);
@@ -1243,7 +1243,7 @@
ibmcam_veio(uvd, 0, 0x0002, 0x0124);
}
-static void ibmcam_send_x_01_00_05(uvd_t *uvd, unsigned short x)
+static void ibmcam_send_x_01_00_05(struct uvd *uvd, unsigned short x)
{
ibmcam_veio(uvd, 0, x, 0x0127);
ibmcam_veio(uvd, 0, 0x0001, 0x0124);
@@ -1251,7 +1251,7 @@
ibmcam_veio(uvd, 0, 0x0005, 0x0124);
}
-static void ibmcam_send_x_00_05_02_01(uvd_t *uvd, unsigned short x)
+static void ibmcam_send_x_00_05_02_01(struct uvd *uvd, unsigned short x)
{
ibmcam_veio(uvd, 0, x, 0x0127);
ibmcam_veio(uvd, 0, 0x0000, 0x0124);
@@ -1260,7 +1260,7 @@
ibmcam_veio(uvd, 0, 0x0001, 0x0124);
}
-static void ibmcam_send_x_00_05_02_08_01(uvd_t *uvd, unsigned short x)
+static void ibmcam_send_x_00_05_02_08_01(struct uvd *uvd, unsigned short x)
{
ibmcam_veio(uvd, 0, x, 0x0127);
ibmcam_veio(uvd, 0, 0x0000, 0x0124);
@@ -1270,7 +1270,7 @@
ibmcam_veio(uvd, 0, 0x0001, 0x0124);
}
-static void ibmcam_Packet_Format1(uvd_t *uvd, unsigned char fkey, unsigned char val)
+static void ibmcam_Packet_Format1(struct uvd *uvd, unsigned char fkey, unsigned char val)
{
ibmcam_send_x_01_00_05(uvd, unknown_88);
ibmcam_send_x_00_05(uvd, fkey);
@@ -1284,20 +1284,20 @@
ibmcam_send_FF_04_02(uvd);
}
-static void ibmcam_PacketFormat2(uvd_t *uvd, unsigned char fkey, unsigned char val)
+static void ibmcam_PacketFormat2(struct uvd *uvd, unsigned char fkey, unsigned char val)
{
ibmcam_send_x_01_00_05 (uvd, unknown_88);
ibmcam_send_x_00_05 (uvd, fkey);
ibmcam_send_x_00_05_02 (uvd, val);
}
-static void ibmcam_model2_Packet2(uvd_t *uvd)
+static void ibmcam_model2_Packet2(struct uvd *uvd)
{
ibmcam_veio(uvd, 0, 0x00ff, 0x012d);
ibmcam_veio(uvd, 0, 0xfea3, 0x0124);
}
-static void ibmcam_model2_Packet1(uvd_t *uvd, unsigned short v1, unsigned short v2)
+static void ibmcam_model2_Packet1(struct uvd *uvd, unsigned short v1, unsigned short v2)
{
ibmcam_veio(uvd, 0, 0x00aa, 0x012d);
ibmcam_veio(uvd, 0, 0x00ff, 0x012e);
@@ -1318,7 +1318,7 @@
* 00_0096_0127
* 00_fea8_0124
*/
-static void ibmcam_model3_Packet1(uvd_t *uvd, unsigned short v1, unsigned short v2)
+static void ibmcam_model3_Packet1(struct uvd *uvd, unsigned short v1, unsigned short v2)
{
ibmcam_veio(uvd, 0, 0x0078, 0x012d);
ibmcam_veio(uvd, 0, v1, 0x012f);
@@ -1327,7 +1327,7 @@
ibmcam_veio(uvd, 0, 0xfea8, 0x0124);
}
-static void ibmcam_model4_BrightnessPacket(uvd_t *uvd, int i)
+static void ibmcam_model4_BrightnessPacket(struct uvd *uvd, int i)
{
ibmcam_veio(uvd, 0, 0x00aa, 0x012d);
ibmcam_veio(uvd, 0, 0x0026, 0x012f);
@@ -1353,7 +1353,7 @@
* History:
* 1/2/00 Created.
*/
-static void ibmcam_adjust_contrast(uvd_t *uvd)
+static void ibmcam_adjust_contrast(struct uvd *uvd)
{
unsigned char a_contrast = uvd->vpic.contrast >> 12;
unsigned char new_contrast;
@@ -1428,7 +1428,7 @@
* 1/5/00 Created.
* 2/20/00 Added support for Model 2 cameras.
*/
-static void ibmcam_change_lighting_conditions(uvd_t *uvd)
+static void ibmcam_change_lighting_conditions(struct uvd *uvd)
{
static const char proc[] = "ibmcam_change_lighting_conditions";
@@ -1474,7 +1474,7 @@
* range [0..6], where 0 is most smooth and 6 is most sharp (raw image, I guess).
* Recommended value is 4. Cameras model 2 do not have this feature at all.
*/
-static void ibmcam_set_sharpness(uvd_t *uvd)
+static void ibmcam_set_sharpness(struct uvd *uvd)
{
static const char proc[] = "ibmcam_set_sharpness";
@@ -1543,7 +1543,7 @@
*
* This procedure changes brightness of the picture.
*/
-static void ibmcam_set_brightness(uvd_t *uvd)
+static void ibmcam_set_brightness(struct uvd *uvd)
{
static const char proc[] = "ibmcam_set_brightness";
static const unsigned short n = 1;
@@ -1608,7 +1608,7 @@
}
}
-static void ibmcam_set_hue(uvd_t *uvd)
+static void ibmcam_set_hue(struct uvd *uvd)
{
switch (IBMCAM_T(uvd)->camera_model) {
case IBMCAM_MODEL_2:
@@ -1704,14 +1704,14 @@
* This procedure gets called from V4L interface to update picture settings.
* Here we change brightness and contrast.
*/
-static void ibmcam_adjust_picture(uvd_t *uvd)
+static void ibmcam_adjust_picture(struct uvd *uvd)
{
ibmcam_adjust_contrast(uvd);
ibmcam_set_brightness(uvd);
ibmcam_set_hue(uvd);
}
-static int ibmcam_model1_setup(uvd_t *uvd)
+static int ibmcam_model1_setup(struct uvd *uvd)
{
const int ntries = 5;
int i;
@@ -1908,7 +1908,7 @@
return (CAMERA_IS_OPERATIONAL(uvd) ? 0 : -EFAULT);
}
-static int ibmcam_model2_setup(uvd_t *uvd)
+static int ibmcam_model2_setup(struct uvd *uvd)
{
ibmcam_veio(uvd, 0, 0x0000, 0x0100); /* LED on */
ibmcam_veio(uvd, 1, 0x0000, 0x0116);
@@ -1966,7 +1966,7 @@
* This code adds finishing touches to the video data interface.
* Here we configure the frame rate and turn on the LED.
*/
-static void ibmcam_model1_setup_after_video_if(uvd_t *uvd)
+static void ibmcam_model1_setup_after_video_if(struct uvd *uvd)
{
unsigned short internal_frame_rate;
@@ -1978,7 +1978,7 @@
ibmcam_veio(uvd, 0, 0xc0, 0x010c);
}
-static void ibmcam_model2_setup_after_video_if(uvd_t *uvd)
+static void ibmcam_model2_setup_after_video_if(struct uvd *uvd)
{
unsigned short setup_model2_rg2, setup_model2_sat, setup_model2_yb;
@@ -2154,7 +2154,7 @@
usb_clear_halt(uvd->dev, usb_rcvisocpipe(uvd->dev, uvd->video_endp));
}
-static void ibmcam_model4_setup_after_video_if(uvd_t *uvd)
+static void ibmcam_model4_setup_after_video_if(struct uvd *uvd)
{
switch (uvd->videosize) {
case VIDEOSIZE_128x96:
@@ -2704,7 +2704,7 @@
usb_clear_halt(uvd->dev, usb_rcvisocpipe(uvd->dev, uvd->video_endp));
}
-static void ibmcam_model3_setup_after_video_if(uvd_t *uvd)
+static void ibmcam_model3_setup_after_video_if(struct uvd *uvd)
{
int i;
/*
@@ -3485,7 +3485,7 @@
* This code tells camera to stop streaming. The interface remains
* configured and bandwidth - claimed.
*/
-static void ibmcam_video_stop(uvd_t *uvd)
+static void ibmcam_video_stop(struct uvd *uvd)
{
switch (IBMCAM_T(uvd)->camera_model) {
case IBMCAM_MODEL_1:
@@ -3546,7 +3546,7 @@
* History:
* 1/2/00 Created.
*/
-static void ibmcam_reinit_iso(uvd_t *uvd, int do_stop)
+static void ibmcam_reinit_iso(struct uvd *uvd, int do_stop)
{
switch (IBMCAM_T(uvd)->camera_model) {
case IBMCAM_MODEL_1:
@@ -3570,7 +3570,7 @@
}
}
-static void ibmcam_video_start(uvd_t *uvd)
+static void ibmcam_video_start(struct uvd *uvd)
{
ibmcam_change_lighting_conditions(uvd);
ibmcam_set_sharpness(uvd);
@@ -3580,7 +3580,7 @@
/*
* Return negative code on failure, 0 on success.
*/
-static int ibmcam_setup_on_open(uvd_t *uvd)
+static int ibmcam_setup_on_open(struct uvd *uvd)
{
int setup_ok = 0; /* Success by default */
/* Send init sequence only once, it's large! */
@@ -3602,7 +3602,7 @@
return setup_ok;
}
-static void ibmcam_configure_video(uvd_t *uvd)
+static void ibmcam_configure_video(struct uvd *uvd)
{
if (uvd == NULL)
return;
@@ -3658,7 +3658,7 @@
*/
static void *ibmcam_probe(struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *devid)
{
- uvd_t *uvd = NULL;
+ struct uvd *uvd = NULL;
int i, nas, model=0, canvasX=0, canvasY=0;
int actInterface=-1, inactInterface=-1, maxPS=0;
unsigned char video_ep = 0;
@@ -3868,7 +3868,7 @@
MOD_INC_USE_COUNT;
uvd = usbvideo_AllocateDevice(cams);
if (uvd != NULL) {
- /* Here uvd is a fully allocated uvd_t object */
+ /* Here uvd is a fully allocated uvd object */
uvd->flags = flags;
uvd->debug = debug;
uvd->dev = dev;
@@ -3899,6 +3899,17 @@
return uvd;
}
+
+static struct usb_device_id id_table[] = {
+ { USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x0002, 0x0002) }, /* Model 1 */
+ { USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x030a, 0x030a) }, /* Model 2 */
+ { USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x0301, 0x0301) }, /* Model 3 */
+ { USB_DEVICE_VER(IBMCAM_VENDOR_ID, NETCAM_PRODUCT_ID, 0x030a, 0x030a) }, /* Model 4 */
+ { USB_DEVICE_VER(IBMCAM_VENDOR_ID, VEO_800C_PRODUCT_ID, 0x030a, 0x030a) }, /* Model 2 */
+ { USB_DEVICE_VER(IBMCAM_VENDOR_ID, VEO_800D_PRODUCT_ID, 0x030a, 0x030a) }, /* Model 4 */
+ { } /* Terminating entry */
+};
+
/*
* ibmcam_init()
*
@@ -3910,7 +3921,7 @@
*/
static int __init ibmcam_init(void)
{
- usbvideo_cb_t cbTbl;
+ struct usbvideo_cb cbTbl;
memset(&cbTbl, 0, sizeof(cbTbl));
cbTbl.probe = ibmcam_probe;
cbTbl.setupOnOpen = ibmcam_setup_on_open;
@@ -3926,7 +3937,8 @@
sizeof(ibmcam_t),
"ibmcam",
&cbTbl,
- THIS_MODULE);
+ THIS_MODULE,
+ id_table);
}
static void __exit ibmcam_cleanup(void)
@@ -3934,15 +3946,6 @@
usbvideo_Deregister(&cams);
}
-static __devinitdata struct usb_device_id id_table[] = {
- { USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x0002, 0x0002) }, /* Model 1 */
- { USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x030a, 0x030a) }, /* Model 2 */
- { USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x0301, 0x0301) }, /* Model 3 */
- { USB_DEVICE_VER(IBMCAM_VENDOR_ID, NETCAM_PRODUCT_ID, 0x030a, 0x030a) }, /* Model 4 */
- { USB_DEVICE_VER(IBMCAM_VENDOR_ID, VEO_800C_PRODUCT_ID, 0x030a, 0x030a) }, /* Model 2 */
- { USB_DEVICE_VER(IBMCAM_VENDOR_ID, VEO_800D_PRODUCT_ID, 0x030a, 0x030a) }, /* Model 4 */
- { } /* Terminating entry */
-};
MODULE_DEVICE_TABLE(usb, id_table);
module_init(ibmcam_init);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)