patch-2.4.22 linux-2.4.22/drivers/macintosh/adb.c
Next file: linux-2.4.22/drivers/macintosh/adbhid.c
Previous file: linux-2.4.22/drivers/isdn/tpam/tpam_queues.c
Back to the patch index
Back to the overall index
- Lines: 74
- Date:
2003-08-25 04:44:42.000000000 -0700
- Orig file:
linux-2.4.21/drivers/macintosh/adb.c
- Orig date:
2002-11-28 15:53:13.000000000 -0800
diff -urN linux-2.4.21/drivers/macintosh/adb.c linux-2.4.22/drivers/macintosh/adb.c
@@ -252,6 +252,10 @@
{
adb_probe_task_pid = kernel_thread(adb_probe_task, NULL,
SIGCHLD | CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ if (adb_probe_task_pid < 0) {
+ adb_probe_task_pid = 0;
+ printk(KERN_ERR "adb: failed to create probe task !\n");
+ }
}
int
@@ -592,7 +596,6 @@
return (*original_address != 0);
}
-
/*
* /dev/adb device driver.
*/
@@ -636,6 +639,27 @@
spin_unlock_irqrestore(&state->lock, flags);
}
+static int
+do_adb_query(struct adb_request *req)
+{
+ int ret = -EINVAL;
+
+ switch(req->data[1])
+ {
+ case ADB_QUERY_GETDEVINFO:
+ if (req->nbytes < 3)
+ break;
+ req->reply[0] = adb_handler[req->data[2]].original_address;
+ req->reply[1] = adb_handler[req->data[2]].handler_id;
+ req->complete = 1;
+ req->reply_len = 2;
+ adb_write_done(req);
+ ret = 0;
+ break;
+ }
+ return ret;
+}
+
static int adb_open(struct inode *inode, struct file *file)
{
struct adbdev_state *state;
@@ -655,6 +679,7 @@
return 0;
}
+/* FIXME: Should wait completion, dequeue & delete pending requests */
static int adb_release(struct inode *inode, struct file *file)
{
struct adbdev_state *state = file->private_data;
@@ -772,9 +797,17 @@
/* If a probe is in progress or we are sleeping, wait for it to complete */
down(&adb_probe_mutex);
+ /* Queries are special requests sent to the ADB driver itself */
+ if (req->data[0] == ADB_QUERY) {
+ if (count > 1)
+ ret = do_adb_query(req);
+ else
+ ret = -EINVAL;
+ up(&adb_probe_mutex);
+ }
/* Special case for ADB_BUSRESET request, all others are sent to
the controller */
- if ((req->data[0] == ADB_PACKET)&&(count > 1)
+ else if ((req->data[0] == ADB_PACKET)&&(count > 1)
&&(req->data[1] == ADB_BUSRESET)) {
ret = do_adb_reset_bus();
up(&adb_probe_mutex);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)