Skip to contentSkip to conversation

input-driver-yealink-P1K-usb-phone

PATCH In review Henk 2 participants 4 messages Aug 16, 2005

Subsystems (3)
lore
Share & tools
lore

Henk

author
#0 lore raw

PATCH 1/1 input-driver-yealink-P1K-usb-phone

This patch aggregates all modifications in the -mm tree and adds complete ringtone support.

The following features are supported:

  - keyboard          full support
  - LCD               full support
  - LED               full support
  - dialtone          full support
  - ringtone          full support
  - audio playback    via generic usb audio diver
  - audio record      via generic usb audio diver

For driver documentation see: Documentation/input/yealink.txt For vendor documentation see: http://yealink.com

Have fun....

Henk

PS. Please CC me directly if you want a response.
---

 Documentation/input/yealink.txt     |  187 ++++++
 MAINTAINERS                         |    6 
 drivers/usb/input/Kconfig           |   14 
 drivers/usb/input/Makefile          |    1 
 drivers/usb/input/map_to_7segment.h |  189 +++++++
 drivers/usb/input/yealink.c         | 1010 +++++++++++++++++++++++++++++++++++
 drivers/usb/input/yealink.h         |  220 ++++++++
 7 files changed, 1627 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/input/yealink.txt
 create mode 100644 drivers/usb/input/map_to_7segment.h
 create mode 100644 drivers/usb/input/yealink.c
 create mode 100644 drivers/usb/input/yealink.h

9842bcfd993de0b4729b38475b617380e3051b06

Documentation/input/yealink.txt new file +187 -0
new file mode 100644
@@ -0,0 +1,187 @@
+yealink - Linux driver for usb-p1k phones
+
+0. Status
+~~~~~~~~~
+
+The p1k is a relatively cheap usb 1.1 phone with:
+  - keyboard		full support
+  - LCD			full support
+  - LED			full support
+  - dialtone		full support
+  - ringtone		full support
+  - audio playback   	via generic usb audio diver
+  - audio record     	via generic usb audio diver
+
+
+1. Compilation (stand alone version)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Currently only kernel 2.6.x.y versions are supported. 
+In order to build the yealink.ko module do:
+
+  make
+
+If you encounter problems please check if in the MAKE_OPTS variable in 
+the Makefile is pointing to the location where your kernel sources
+are located, default /usr/src/linux.
+
+
+
+2. keyboard features
+~~~~~~~~~~~~~~~~~~~~
+The current mapping in the kernel is provided by the map_p1k_to_key
+function:
+
+   Physical USB-P1K button layout	input events
+
+
+              up			     up
+        IN           OUT		left,	right
+             down			    down
+
+      pickup   C    hangup		enter, backspace, escape
+        1      2      3			1, 2, 3
+        4      5      6			4, 5, 6,
+        7      8      9			7, 8, 9,
+        *      0      #			*, 0, #,
+
+  The "up" and "down" keys, are symbolised by arrows on the button.
+  The "pickup" and "hangup" keys are symbolised by a green and red phone
+  on the button.
+
+
+3. LCD features
+~~~~~~~~~~~~~~~
+The LCD is divided and organised as a 3 line display:
+
+    |[]   [][]   [][]   [][]   in   |[][]
+    |[] M [][] D [][] : [][]   out  |[][]
+                              store
+
+    NEW REP         SU MO TU WE TH FR SA
+
+    [] [] [] [] [] [] [] [] [] [] [] []
+    [] [] [] [] [] [] [] [] [] [] [] []
+
+
+Line 1	Format (see below)	: 18.e8.M8.88...188
+	Icon names		:   M  D  :  IN OUT STORE
+Line 2  Format			: .........
+	Icon name		: NEW REP SU MO TU WE TH FR SA
+Line 3  Format			: 888888888888
+
+
+Format description:
+  From a user space perspective the world is seperated in "digits" and "icons".
+  A digit can have a character set, an icon can only be ON or OFF.
+
+  Format specifier
+    '8' :  Generic 7 segment digit with individual addressable segments
+
+    Reduced capabillity 7 segm digit, when segments are hard wired together.
+    '1' : 2 segments digit only able to produce a 1.
+    'e' : Most significant day of the month digit,
+          able to produce at least 1 2 3.
+    'M' : Most significant minute digit,
+          able to produce at least 0 1 2 3 4 5.
+
+    Icons or pictograms:
+    '.' : For example like AM, PM, SU, a 'dot' .. or other single segment
+	  elements.
+
+
+4. Driver usage
+~~~~~~~~~~~~~~~
+For userland the following interfaces are available using the sysfs interface:
+  /sys/.../
+           line1	Read/Write, lcd line1
+           line2	Read/Write, lcd line2
+           line3	Read/Write, lcd line3
+
+	   get_icons    Read, returns a set of available icons.
+	   hide_icon    Write, hide the element by writing the icon name.
+	   show_icon    Write, display the element by writing the icon name.
+
+	   map_seg7	Read/Write, the 7 segments char set, common for all
+	   		yealink phones. (see map_to_7segment.h)
+
+	   ringtone	Write, upload binary representation of a ringtone,
+	   		see yealink.c. status EXPERIMENTAL due to potential
+			races between async. and sync usb calls.
+
+
+4.1 lineX
+~~~~~~~~~
+Reading /sys/../lineX will return the format string with its current value:
+
+  Example:
+  cat ./line3
+  888888888888
+  Linux Rocks!
+
+Writing to /sys/../lineX will set the coresponding LCD line.
+ - Excess characters are ignored.
+ - If less characters are written than allowed, the remaining digits are
+   unchanged.
+ - The tab '\t'and '\n' char does not overwrite the original content.
+ - Writing a space to an icon will always hide its content.
+
+  Example:
+  date +"%m.%e.%k:%M"  | sed 's/^0/ /' > ./line1
+
+  Will update the LCD with the current date & time.
+
+
+4.2 get_icons 
+~~~~~~~~~~~~~
+Reading will return all available icon names and its current settings:
+
+  cat ./get_icons
+  on M
+  on D
+  on :
+     IN
+     OUT
+     STORE
+     NEW
+     REP
+     SU
+     MO
+     TU
+     WE
+     TH
+     FR
+     SA
+     LED
+     DIALTONE
+     RINGTONE
+
+
+4.3 show/hide icons 
+~~~~~~~~~~~~~~~~~~~
+Writing to these files will update the state of the icon.
+Only one icon at a time can be updated.
+
+If an icon is also on a ./lineX the corresponding value is
+updated with the first letter of the icon.
+
+  Example - light up the store icon:
+  echo -n "STORE" > ./show_icon
+
+  cat ./line1
+  18.e8.M8.88...188
+               S
+
+  Example - sound the ringtone for 10 seconds:
+  echo -n RINGTONE > /sys/..../show_icon
+  sleep 10
+  echo -n RINGTONE > /sys/..../hide_icon
+
+
+5. Credits & Acknowledgments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  - Olivier Vandorpe, for starting the usbb2k-api project doing much of
+	the reverse engineering.
+  - Martin Diehl, for pointing out how to handle USB memory allocation.
+  - Dmitry Torokhov, for the numerous code reviews and suggestions.
+
MAINTAINERS +6 -0
@@ -116,6 +116,12 @@ M:	[email protected]
 L:	[email protected]
 S:	Maintained
 
+YEALINK PHONE DRIVER
+P:	Henk Vergonet
+M:	[email protected]
+L:	[email protected]
+S:	Maintained
+
 8139CP 10/100 FAST ETHERNET DRIVER
 P:	Jeff Garzik
 M:	[email protected]
drivers/usb/input/Kconfig +14 -0
@@ -230,6 +230,20 @@ config USB_EGALAX
 	  To compile this driver as a module, choose M here: the
 	  module will be called touchkitusb.
 
+config USB_YEALINK
+	tristate "Yealink usb-p1k voip phone"
+	depends on USB && INPUT && EXPERIMENTAL
+	---help---
+	  Say Y here if you want to enable keyboard and LCD functions of the
+	  Yealink usb-p1k usb phones. The audio part is enabled by the generic
+	  usb sound driver, so you might want to enable that as well.
+
+	  For information about how to use these additional functions, see
+	  <file:Documentation/input/yealink.txt>.
+
+	  To compile this driver as a module, choose M here: the module will be
+	  called yealink.
+
 config USB_XPAD
 	tristate "X-Box gamepad support"
 	depends on USB && INPUT
drivers/usb/input/Makefile +1 -0
@@ -39,4 +39,5 @@ obj-$(CONFIG_USB_EGALAX)	+= touchkitusb.
 obj-$(CONFIG_USB_POWERMATE)	+= powermate.o
 obj-$(CONFIG_USB_WACOM)		+= wacom.o
 obj-$(CONFIG_USB_ACECAD)	+= acecad.o
+obj-$(CONFIG_USB_YEALINK)	+= yealink.o
 obj-$(CONFIG_USB_XPAD)		+= xpad.o
drivers/usb/input/map_to_7segment.h new file +189 -0

189 lines not on this page · raw message

drivers/usb/input/yealink.c new file +1010 -0

1,010 lines not on this page · raw message

drivers/usb/input/yealink.h new file +220 -0

220 lines not on this page · raw message

----- End forwarded message -----

#1 lore raw
Quoted 2 lines · Henk

- audio playback via generic usb audio diver
- audio record via generic usb audio diver

There is no such thing.

Do you mean the obsolete OSS usb-audio driver, or snd-usb-audio?

Lee

author
#2 lore raw
Quoted 10 lines · Lee Revell
Quoted 2 lines · Henk

- audio playback via generic usb audio diver
- audio record via generic usb audio diver

There is no such thing.

Do you mean the obsolete OSS usb-audio driver, or snd-usb-audio?

Lee

Ehm, I did not know there was still an OSS usb driver.

I have:

Module                  Size  Used by
snd_usb_audio          71936  1
snd_usb_lib            13568  1 snd_usb_audio
snd_rawmidi            20448  1 snd_usb_lib
snd_hwdep               7008  1 snd_usb_audio
yealink                11072  0

and playback is working fine on 2.6.13-rc6.

Today we create the legacy of tomorrow ;).

Henk

#3 lore raw
Quoted 1 line · Henk

Ehm, I did not know there was still an OSS usb driver.

Thankfully it's going away real soon. It failed to depend on OSS, didn't have decent help text, and doesn't live under Sound so lots of people got them confused. Most ALSA based distros failed to even blacklist it by default so hotplug would load it preferentially to the ALSA driver. See the gazillion bug reports on the ALSA lists.

Lee