yealink.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*
  2. * drivers/usb/input/yealink.h
  3. *
  4. * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com>
  5. *
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #ifndef INPUT_YEALINK_H
  22. #define INPUT_YEALINK_H
  23. /* Using the control channel on interface 3 various aspects of the phone
  24. * can be controlled like LCD, LED, dialtone and the ringtone.
  25. */
  26. struct yld_ctl_packet {
  27. u8 cmd; /* command code, see below */
  28. u8 size; /* 1-11, size of used data bytes. */
  29. u16 offset; /* internal packet offset */
  30. u8 data[11];
  31. s8 sum; /* negative sum of 15 preceding bytes */
  32. } __attribute__ ((packed));
  33. #define USB_PKT_LEN sizeof(struct yld_ctl_packet)
  34. /* The following yld_ctl_packet's are available: */
  35. /* Init registers
  36. *
  37. * cmd 0x8e
  38. * size 10
  39. * offset 0
  40. * data 0,0,0,0....
  41. */
  42. #define CMD_INIT 0x8e
  43. /* Request key scan
  44. *
  45. * cmd 0x80
  46. * size 1
  47. * offset 0
  48. * data[0] on return returns the key number, if it changes there's a new
  49. * key pressed.
  50. */
  51. #define CMD_KEYPRESS 0x80
  52. /* Request scancode
  53. *
  54. * cmd 0x81
  55. * size 1
  56. * offset key number [0-1f]
  57. * data[0] on return returns the scancode
  58. */
  59. #define CMD_SCANCODE 0x81
  60. /* Set LCD
  61. *
  62. * cmd 0x04
  63. * size 1-11
  64. * offset 0-23
  65. * data segment bits
  66. */
  67. #define CMD_LCD 0x04
  68. /* Set led
  69. *
  70. * cmd 0x05
  71. * size 1
  72. * offset 0
  73. * data[0] 0 OFF / 1 ON
  74. */
  75. #define CMD_LED 0x05
  76. /* Set ringtone volume
  77. *
  78. * cmd 0x11
  79. * size 1
  80. * offset 0
  81. * data[0] 0-0xff volume
  82. */
  83. #define CMD_RING_VOLUME 0x11
  84. /* Set ringtone notes
  85. *
  86. * cmd 0x02
  87. * size 1-11
  88. * offset 0->
  89. * data binary representation LE16(-freq), LE16(duration) ....
  90. */
  91. #define CMD_RING_NOTE 0x02
  92. /* Sound ringtone via the speaker on the back
  93. *
  94. * cmd 0x03
  95. * size 1
  96. * offset 0
  97. * data[0] 0 OFF / 0x24 ON
  98. */
  99. #define CMD_RINGTONE 0x03
  100. /* Sound dial tone via the ear speaker
  101. *
  102. * cmd 0x09
  103. * size 1
  104. * offset 0
  105. * data[0] 0 OFF / 1 ON
  106. */
  107. #define CMD_DIALTONE 0x09
  108. #endif /* INPUT_YEALINK_H */
  109. #if defined(_SEG) && defined(_PIC)
  110. /* This table maps the LCD segments onto individual bit positions in the
  111. * yld_status struct.
  112. */
  113. /* LCD, each segment must be driven separately.
  114. *
  115. * Layout:
  116. *
  117. * |[] [][] [][] [][] in |[][]
  118. * |[] M [][] D [][] : [][] out |[][]
  119. * store
  120. *
  121. * NEW REP SU MO TU WE TH FR SA
  122. *
  123. * [] [] [] [] [] [] [] [] [] [] [] []
  124. * [] [] [] [] [] [] [] [] [] [] [] []
  125. */
  126. /* Line 1
  127. * Format : 18.e8.M8.88...188
  128. * Icon names : M D : IN OUT STORE
  129. */
  130. #define LCD_LINE1_OFFSET 0
  131. #define LCD_LINE1_SIZE 17
  132. /* Note: first g then f => ! ! */
  133. /* _SEG( type a b c d e g f ) */
  134. _SEG('1', 0,0 , 22,2 , 22,2 , 0,0 , 0,0 , 0,0 , 0,0 ),
  135. _SEG('8', 20,1 , 20,2 , 20,4 , 20,8 , 21,4 , 21,2 , 21,1 ),
  136. _PIC('.', 22,1 , "M" ),
  137. _SEG('e', 18,1 , 18,2 , 18,4 , 18,1 , 19,2 , 18,1 , 19,1 ),
  138. _SEG('8', 16,1 , 16,2 , 16,4 , 16,8 , 17,4 , 17,2 , 17,1 ),
  139. _PIC('.', 15,8 , "D" ),
  140. _SEG('M', 14,1 , 14,2 , 14,4 , 14,1 , 15,4 , 15,2 , 15,1 ),
  141. _SEG('8', 12,1 , 12,2 , 12,4 , 12,8 , 13,4 , 13,2 , 13,1 ),
  142. _PIC('.', 11,8 , ":" ),
  143. _SEG('8', 10,1 , 10,2 , 10,4 , 10,8 , 11,4 , 11,2 , 11,1 ),
  144. _SEG('8', 8,1 , 8,2 , 8,4 , 8,8 , 9,4 , 9,2 , 9,1 ),
  145. _PIC('.', 7,1 , "IN" ),
  146. _PIC('.', 7,2 , "OUT" ),
  147. _PIC('.', 7,4 , "STORE" ),
  148. _SEG('1', 0,0 , 5,1 , 5,1 , 0,0 , 0,0 , 0,0 , 0,0 ),
  149. _SEG('8', 4,1 , 4,2 , 4,4 , 4,8 , 5,8 , 5,4 , 5,2 ),
  150. _SEG('8', 2,1 , 2,2 , 2,4 , 2,8 , 3,4 , 3,2 , 3,1 ),
  151. /* Line 2
  152. * Format : .........
  153. * Pict. name : NEW REP SU MO TU WE TH FR SA
  154. */
  155. #define LCD_LINE2_OFFSET LCD_LINE1_OFFSET + LCD_LINE1_SIZE
  156. #define LCD_LINE2_SIZE 9
  157. _PIC('.', 23,2 , "NEW" ),
  158. _PIC('.', 23,4 , "REP" ),
  159. _PIC('.', 1,8 , "SU" ),
  160. _PIC('.', 1,4 , "MO" ),
  161. _PIC('.', 1,2 , "TU" ),
  162. _PIC('.', 1,1 , "WE" ),
  163. _PIC('.', 0,1 , "TH" ),
  164. _PIC('.', 0,2 , "FR" ),
  165. _PIC('.', 0,4 , "SA" ),
  166. /* Line 3
  167. * Format : 888888888888
  168. */
  169. #define LCD_LINE3_OFFSET LCD_LINE2_OFFSET + LCD_LINE2_SIZE
  170. #define LCD_LINE3_SIZE 12
  171. _SEG('8', 22,16, 22,32, 22,64, 22,128, 23,128, 23,64, 23,32 ),
  172. _SEG('8', 20,16, 20,32, 20,64, 20,128, 21,128, 21,64, 21,32 ),
  173. _SEG('8', 18,16, 18,32, 18,64, 18,128, 19,128, 19,64, 19,32 ),
  174. _SEG('8', 16,16, 16,32, 16,64, 16,128, 17,128, 17,64, 17,32 ),
  175. _SEG('8', 14,16, 14,32, 14,64, 14,128, 15,128, 15,64, 15,32 ),
  176. _SEG('8', 12,16, 12,32, 12,64, 12,128, 13,128, 13,64, 13,32 ),
  177. _SEG('8', 10,16, 10,32, 10,64, 10,128, 11,128, 11,64, 11,32 ),
  178. _SEG('8', 8,16, 8,32, 8,64, 8,128, 9,128, 9,64, 9,32 ),
  179. _SEG('8', 6,16, 6,32, 6,64, 6,128, 7,128, 7,64, 7,32 ),
  180. _SEG('8', 4,16, 4,32, 4,64, 4,128, 5,128, 5,64, 5,32 ),
  181. _SEG('8', 2,16, 2,32, 2,64, 2,128, 3,128, 3,64, 3,32 ),
  182. _SEG('8', 0,16, 0,32, 0,64, 0,128, 1,128, 1,64, 1,32 ),
  183. /* Line 4
  184. *
  185. * The LED, DIALTONE and RINGTONE are implemented as icons and use the same
  186. * sysfs interface.
  187. */
  188. #define LCD_LINE4_OFFSET LCD_LINE3_OFFSET + LCD_LINE3_SIZE
  189. _PIC('.', offsetof(struct yld_status, led) , 0x01, "LED" ),
  190. _PIC('.', offsetof(struct yld_status, dialtone) , 0x01, "DIALTONE" ),
  191. _PIC('.', offsetof(struct yld_status, ringtone) , 0x24, "RINGTONE" ),
  192. #undef _SEG
  193. #undef _PIC
  194. #endif /* _SEG && _PIC */