Thread (1 message) 1 message, 1 author, 2008-03-03

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

From: Alfred E. Heggestad <hidden>
Date: 2008-03-03 22:10:30
Also in: lkml

Possibly related (same subject, not in this thread)

Oliver Neukum wrote:
Am Donnerstag, 7. Februar 2008 19:38:10 schrieb Alfred E. Heggestad:
quoted
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help