patch-2.3.10 linux/drivers/char/c-qcam.c
Next file: linux/drivers/char/chipsets.h
Previous file: linux/drivers/char/bw-qcam.c
Back to the patch index
Back to the overall index
- Lines: 133
- Date:
Mon Jul 5 20:07:02 1999
- Orig file:
v2.3.9/linux/drivers/char/c-qcam.c
- Orig date:
Wed Dec 16 12:53:13 1998
diff -u --recursive --new-file v2.3.9/linux/drivers/char/c-qcam.c linux/drivers/char/c-qcam.c
@@ -1,6 +1,6 @@
/*
* Video4Linux Colour QuickCam driver
- * Copyright 1997-1998 Philip Blundell <philb@gnu.org>
+ * Copyright 1997-1999 Philip Blundell <philb@gnu.org>
*
*/
@@ -294,7 +294,7 @@
if (is_bi_dir)
{
/* Turn the port around */
- parport_frob_control(q->pport, 0x20, 0x20);
+ parport_data_reverse(q->pport);
mdelay(3);
qcam_set_ack(q, 0);
if (qcam_await_ready1(q, 1)) {
@@ -336,7 +336,7 @@
{
printk("qcam: short read.\n");
if (is_bi_dir)
- parport_frob_control(q->pport, 0x20, 0);
+ parport_data_forward(q->pport);
qc_setup(q);
return len;
}
@@ -355,11 +355,11 @@
if (qcam_await_ready1(q, 1))
{
printk("qcam: no ack after EOF\n");
- parport_frob_control(q->pport, 0x20, 0);
+ parport_data_forward(q->pport);
qc_setup(q);
return len;
}
- parport_frob_control(q->pport, 0x20, 0);
+ parport_data_forward(q->pport);
mdelay(3);
qcam_set_ack(q, 1);
if (qcam_await_ready1(q, 0))
@@ -641,12 +641,14 @@
struct qcam_device *q;
q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL);
+ if(q==NULL)
+ return NULL;
q->pport = port;
q->pdev = parport_register_device(port, "c-qcam", NULL, NULL,
NULL, 0, NULL);
- q->bidirectional = (q->pport->modes & PARPORT_MODE_PCPS2)?1:0;
+ q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0;
if (q->pdev == NULL)
{
@@ -678,10 +680,7 @@
struct qcam_device *qcam;
if (num_cams == MAX_CAMS)
- {
- printk(KERN_ERR "Too many Quickcams (max %d)\n", MAX_CAMS);
return -ENOSPC;
- }
qcam = qcam_init(port);
if (qcam==NULL)
@@ -725,19 +724,40 @@
kfree(qcam);
}
-#define BANNER "Connectix Colour Quickcam driver v0.02\n"
+#define BANNER "Connectix Colour Quickcam driver v0.03"
-#ifdef MODULE
-int init_module(void)
+static void cq_attach(struct parport *port)
+{
+ init_cqcam(port);
+}
+
+static void cq_detach(struct parport *port)
+{
+ /* Write this some day. */
+}
+
+static struct parport_driver cqcam_driver = {
+ "cqcam",
+ cq_attach,
+ cq_detach,
+ NULL
+};
+
+static void cqcam_init(void)
{
- struct parport *port;
+ printk(BANNER "\n");
+ parport_register_driver(&cqcam_driver);
+}
- printk(BANNER);
+#ifdef MODULE
- for (port = parport_enumerate(); port; port=port->next)
- init_cqcam(port);
+MODULE_AUTHOR("Philip Blundell <philb@gnu.org>");
+MODULE_DESCRIPTION(BANNER);
- return (num_cams)?0:-ENODEV;
+int init_module(void)
+{
+ cqcam_init();
+ return 0;
}
void cleanup_module(void)
@@ -747,14 +767,9 @@
close_cqcam(qcams[i]);
}
#else
-__initfunc(int init_colour_qcams(struct video_init *unused))
+int __init init_colour_qcams(struct video_init *unused)
{
- struct parport *port;
-
- printk(BANNER);
-
- for (port = parport_enumerate(); port; port=port->next)
- init_cqcam(port);
+ cqcam_init();
return 0;
}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)