Re: [PATCH] input: driver for USB VoIP phones with CM109 chipset

From: Alfred E. Heggestad
Date: Mon Mar 03 2008 - 17:10:31 EST


Oliver Neukum wrote:
Am Donnerstag, 7. Februar 2008 19:38:10 schrieb Alfred E. Heggestad:
+static void buzz(struct cm109_dev *dev, int on)
+{
+ int ret;
+
+ if (dev == NULL) {
+ err("buzz: dev is NULL");
+ return;
+ }
+
+ dbg("Buzzer %s", on ? "on" : "off");
+ if (on)
+ dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
+ else
+ dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
+
+ ret = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
+ if (ret)
+ err("%s - usb_submit_urb failed %d", __FUNCTION__, ret);
+}
+
+static int input_ev(struct input_dev *idev, unsigned int type,
+ unsigned int code, int value)
+{
+ struct cm109_dev *dev = input_get_drvdata(idev);
+ unsigned long flags;
+
+#ifdef CM109_DEBUG
+ info("input_ev: type=%u code=%u value=%d", type, code, value);
+#endif
+
+ if (type != EV_SND)
+ return -EINVAL;
+
+ switch (code) {
+ case SND_TONE:
+ case SND_BELL:
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ spin_lock_irqsave(&cm109_buzz_lock, flags);
+ buzz(dev, value);
+ spin_unlock_irqrestore(&cm109_buzz_lock, flags);
+
+ return 0;
+}

What makes you sure you finished the URB to switch the buzzer on before
you try to switch it off again? It seems that you might be attempting to
manipulate a live URB there if you hit the window.


thanks for the hint. could you let me know how I can fix this properly,
or point me to some USB driver code that implements this correctly.. ?


/alfred

Regards
Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/