yealink.txt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. yealink - Linux driver for usb-p1k phones
  2. 0. Status
  3. ~~~~~~~~~
  4. The p1k is a relatively cheap usb 1.1 phone with:
  5. - keyboard full support
  6. - LCD full support
  7. - LED full support
  8. - dialtone full support
  9. - ringtone full support
  10. - audio playback via generic usb audio diver
  11. - audio record via generic usb audio diver
  12. 1. Compilation (stand alone version)
  13. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  14. Currently only kernel 2.6.x.y versions are supported.
  15. In order to build the yealink.ko module do:
  16. make
  17. If you encounter problems please check if in the MAKE_OPTS variable in
  18. the Makefile is pointing to the location where your kernel sources
  19. are located, default /usr/src/linux.
  20. 2. keyboard features
  21. ~~~~~~~~~~~~~~~~~~~~
  22. The current mapping in the kernel is provided by the map_p1k_to_key
  23. function:
  24. Physical USB-P1K button layout input events
  25. up up
  26. IN OUT left, right
  27. down down
  28. pickup C hangup enter, backspace, escape
  29. 1 2 3 1, 2, 3
  30. 4 5 6 4, 5, 6,
  31. 7 8 9 7, 8, 9,
  32. * 0 # *, 0, #,
  33. The "up" and "down" keys, are symbolised by arrows on the button.
  34. The "pickup" and "hangup" keys are symbolised by a green and red phone
  35. on the button.
  36. 3. LCD features
  37. ~~~~~~~~~~~~~~~
  38. The LCD is divided and organised as a 3 line display:
  39. |[] [][] [][] [][] in |[][]
  40. |[] M [][] D [][] : [][] out |[][]
  41. store
  42. NEW REP SU MO TU WE TH FR SA
  43. [] [] [] [] [] [] [] [] [] [] [] []
  44. [] [] [] [] [] [] [] [] [] [] [] []
  45. Line 1 Format (see below) : 18.e8.M8.88...188
  46. Icon names : M D : IN OUT STORE
  47. Line 2 Format : .........
  48. Icon name : NEW REP SU MO TU WE TH FR SA
  49. Line 3 Format : 888888888888
  50. Format description:
  51. From a user space perspective the world is seperated in "digits" and "icons".
  52. A digit can have a character set, an icon can only be ON or OFF.
  53. Format specifier
  54. '8' : Generic 7 segment digit with individual addressable segments
  55. Reduced capabillity 7 segm digit, when segments are hard wired together.
  56. '1' : 2 segments digit only able to produce a 1.
  57. 'e' : Most significant day of the month digit,
  58. able to produce at least 1 2 3.
  59. 'M' : Most significant minute digit,
  60. able to produce at least 0 1 2 3 4 5.
  61. Icons or pictograms:
  62. '.' : For example like AM, PM, SU, a 'dot' .. or other single segment
  63. elements.
  64. 4. Driver usage
  65. ~~~~~~~~~~~~~~~
  66. For userland the following interfaces are available using the sysfs interface:
  67. /sys/.../
  68. line1 Read/Write, lcd line1
  69. line2 Read/Write, lcd line2
  70. line3 Read/Write, lcd line3
  71. get_icons Read, returns a set of available icons.
  72. hide_icon Write, hide the element by writing the icon name.
  73. show_icon Write, display the element by writing the icon name.
  74. map_seg7 Read/Write, the 7 segments char set, common for all
  75. yealink phones. (see map_to_7segment.h)
  76. ringtone Write, upload binary representation of a ringtone,
  77. see yealink.c. status EXPERIMENTAL due to potential
  78. races between async. and sync usb calls.
  79. 4.1 lineX
  80. ~~~~~~~~~
  81. Reading /sys/../lineX will return the format string with its current value:
  82. Example:
  83. cat ./line3
  84. 888888888888
  85. Linux Rocks!
  86. Writing to /sys/../lineX will set the coresponding LCD line.
  87. - Excess characters are ignored.
  88. - If less characters are written than allowed, the remaining digits are
  89. unchanged.
  90. - The tab '\t'and '\n' char does not overwrite the original content.
  91. - Writing a space to an icon will always hide its content.
  92. Example:
  93. date +"%m.%e.%k:%M" | sed 's/^0/ /' > ./line1
  94. Will update the LCD with the current date & time.
  95. 4.2 get_icons
  96. ~~~~~~~~~~~~~
  97. Reading will return all available icon names and its current settings:
  98. cat ./get_icons
  99. on M
  100. on D
  101. on :
  102. IN
  103. OUT
  104. STORE
  105. NEW
  106. REP
  107. SU
  108. MO
  109. TU
  110. WE
  111. TH
  112. FR
  113. SA
  114. LED
  115. DIALTONE
  116. RINGTONE
  117. 4.3 show/hide icons
  118. ~~~~~~~~~~~~~~~~~~~
  119. Writing to these files will update the state of the icon.
  120. Only one icon at a time can be updated.
  121. If an icon is also on a ./lineX the corresponding value is
  122. updated with the first letter of the icon.
  123. Example - light up the store icon:
  124. echo -n "STORE" > ./show_icon
  125. cat ./line1
  126. 18.e8.M8.88...188
  127. S
  128. Example - sound the ringtone for 10 seconds:
  129. echo -n RINGTONE > /sys/..../show_icon
  130. sleep 10
  131. echo -n RINGTONE > /sys/..../hide_icon
  132. 5. Credits & Acknowledgments
  133. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  134. - Olivier Vandorpe, for starting the usbb2k-api project doing much of
  135. the reverse engineering.
  136. - Martin Diehl, for pointing out how to handle USB memory allocation.
  137. - Dmitry Torokhov, for the numerous code reviews and suggestions.