yealink.rst 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. ===============================================
  2. Driver documentation for yealink usb-p1k phones
  3. ===============================================
  4. Status
  5. ======
  6. The p1k is a relatively cheap usb 1.1 phone with:
  7. - keyboard full support, yealink.ko / input event API
  8. - LCD full support, yealink.ko / sysfs API
  9. - LED full support, yealink.ko / sysfs API
  10. - dialtone full support, yealink.ko / sysfs API
  11. - ringtone full support, yealink.ko / sysfs API
  12. - audio playback full support, snd_usb_audio.ko / alsa API
  13. - audio record full support, snd_usb_audio.ko / alsa API
  14. For vendor documentation see http://www.yealink.com
  15. keyboard features
  16. =================
  17. The current mapping in the kernel is provided by the map_p1k_to_key
  18. function::
  19. Physical USB-P1K button layout input events
  20. up up
  21. IN OUT left, right
  22. down down
  23. pickup C hangup enter, backspace, escape
  24. 1 2 3 1, 2, 3
  25. 4 5 6 4, 5, 6,
  26. 7 8 9 7, 8, 9,
  27. * 0 # *, 0, #,
  28. The "up" and "down" keys, are symbolised by arrows on the button.
  29. The "pickup" and "hangup" keys are symbolised by a green and red phone
  30. on the button.
  31. LCD features
  32. ============
  33. The LCD is divided and organised as a 3 line display::
  34. |[] [][] [][] [][] in |[][]
  35. |[] M [][] D [][] : [][] out |[][]
  36. store
  37. NEW REP SU MO TU WE TH FR SA
  38. [] [] [] [] [] [] [] [] [] [] [] []
  39. [] [] [] [] [] [] [] [] [] [] [] []
  40. Line 1 Format (see below) : 18.e8.M8.88...188
  41. Icon names : M D : IN OUT STORE
  42. Line 2 Format : .........
  43. Icon name : NEW REP SU MO TU WE TH FR SA
  44. Line 3 Format : 888888888888
  45. Format description:
  46. From a userspace perspective the world is separated into "digits" and "icons".
  47. A digit can have a character set, an icon can only be ON or OFF.
  48. Format specifier::
  49. '8' : Generic 7 segment digit with individual addressable segments
  50. Reduced capability 7 segment digit, when segments are hard wired together.
  51. '1' : 2 segments digit only able to produce a 1.
  52. 'e' : Most significant day of the month digit,
  53. able to produce at least 1 2 3.
  54. 'M' : Most significant minute digit,
  55. able to produce at least 0 1 2 3 4 5.
  56. Icons or pictograms:
  57. '.' : For example like AM, PM, SU, a 'dot' .. or other single segment
  58. elements.
  59. Driver usage
  60. ============
  61. For userland the following interfaces are available using the sysfs interface::
  62. /sys/.../
  63. line1 Read/Write, lcd line1
  64. line2 Read/Write, lcd line2
  65. line3 Read/Write, lcd line3
  66. get_icons Read, returns a set of available icons.
  67. hide_icon Write, hide the element by writing the icon name.
  68. show_icon Write, display the element by writing the icon name.
  69. map_seg7 Read/Write, the 7 segments char set, common for all
  70. yealink phones. (see map_to_7segment.h)
  71. ringtone Write, upload binary representation of a ringtone,
  72. see yealink.c. status EXPERIMENTAL due to potential
  73. races between async. and sync usb calls.
  74. lineX
  75. ~~~~~
  76. Reading /sys/../lineX will return the format string with its current value.
  77. Example::
  78. cat ./line3
  79. 888888888888
  80. Linux Rocks!
  81. Writing to /sys/../lineX will set the corresponding LCD line.
  82. - Excess characters are ignored.
  83. - If less characters are written than allowed, the remaining digits are
  84. unchanged.
  85. - The tab '\t'and '\n' char does not overwrite the original content.
  86. - Writing a space to an icon will always hide its content.
  87. Example::
  88. date +"%m.%e.%k:%M" | sed 's/^0/ /' > ./line1
  89. Will update the LCD with the current date & time.
  90. get_icons
  91. ~~~~~~~~~
  92. Reading will return all available icon names and its current settings::
  93. cat ./get_icons
  94. on M
  95. on D
  96. on :
  97. IN
  98. OUT
  99. STORE
  100. NEW
  101. REP
  102. SU
  103. MO
  104. TU
  105. WE
  106. TH
  107. FR
  108. SA
  109. LED
  110. DIALTONE
  111. RINGTONE
  112. show/hide icons
  113. ~~~~~~~~~~~~~~~
  114. Writing to these files will update the state of the icon.
  115. Only one icon at a time can be updated.
  116. If an icon is also on a ./lineX the corresponding value is
  117. updated with the first letter of the icon.
  118. Example - light up the store icon::
  119. echo -n "STORE" > ./show_icon
  120. cat ./line1
  121. 18.e8.M8.88...188
  122. S
  123. Example - sound the ringtone for 10 seconds::
  124. echo -n RINGTONE > /sys/..../show_icon
  125. sleep 10
  126. echo -n RINGTONE > /sys/..../hide_icon
  127. Sound features
  128. ==============
  129. Sound is supported by the ALSA driver: snd_usb_audio
  130. One 16-bit channel with sample and playback rates of 8000 Hz is the practical
  131. limit of the device.
  132. Example - recording test::
  133. arecord -v -d 10 -r 8000 -f S16_LE -t wav foobar.wav
  134. Example - playback test::
  135. aplay foobar.wav
  136. Troubleshooting
  137. ===============
  138. :Q: Module yealink compiled and installed without any problem but phone
  139. is not initialized and does not react to any actions.
  140. :A: If you see something like:
  141. hiddev0: USB HID v1.00 Device [Yealink Network Technology Ltd. VOIP USB Phone
  142. in dmesg, it means that the hid driver has grabbed the device first. Try to
  143. load module yealink before any other usb hid driver. Please see the
  144. instructions provided by your distribution on module configuration.
  145. :Q: Phone is working now (displays version and accepts keypad input) but I can't
  146. find the sysfs files.
  147. :A: The sysfs files are located on the particular usb endpoint. On most
  148. distributions you can do: "find /sys/ -name get_icons" for a hint.
  149. Credits & Acknowledgments
  150. =========================
  151. - Olivier Vandorpe, for starting the usbb2k-api project doing much of
  152. the reverse engineering.
  153. - Martin Diehl, for pointing out how to handle USB memory allocation.
  154. - Dmitry Torokhov, for the numerous code reviews and suggestions.