<!DOCTYPE html>
<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>18. Driver documentation for yealink usb-p1k phones — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=3918102e" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Human Interface Devices (HID)" href="../../hid/index.html" />
<link rel="prev" title="17. xpad - Linux USB driver for Xbox compatible controllers" href="xpad.html" />
<link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../subsystem-apis.html#human-interfaces">Human interfaces</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="../index.html">Input Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../hid/index.html">Human Interface Devices (HID)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../sound/index.html">Sound Subsystem Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../gpu/index.html">GPU Driver Developer’s Guide</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../fb/index.html">Frame Buffer</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../leds/index.html">LEDs</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#networking-interfaces">Networking interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#storage-interfaces">Storage interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/input/devices/yealink.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="driver-documentation-for-yealink-usb-p1k-phones">
<h1><span class="section-number">18. </span>Driver documentation for yealink usb-p1k phones<a class="headerlink" href="#driver-documentation-for-yealink-usb-p1k-phones" title="Link to this heading">¶</a></h1>
<section id="status">
<h2><span class="section-number">18.1. </span>Status<a class="headerlink" href="#status" title="Link to this heading">¶</a></h2>
<p>The p1k is a relatively cheap usb 1.1 phone with:</p>
<blockquote>
<div><ul class="simple">
<li><p>keyboard full support, yealink.ko / input event API</p></li>
<li><p>LCD full support, yealink.ko / sysfs API</p></li>
<li><p>LED full support, yealink.ko / sysfs API</p></li>
<li><p>dialtone full support, yealink.ko / sysfs API</p></li>
<li><p>ringtone full support, yealink.ko / sysfs API</p></li>
<li><p>audio playback full support, snd_usb_audio.ko / alsa API</p></li>
<li><p>audio record full support, snd_usb_audio.ko / alsa API</p></li>
</ul>
</div></blockquote>
<p>For vendor documentation see <a class="reference external" href="http://www.yealink.com">http://www.yealink.com</a></p>
</section>
<section id="keyboard-features">
<h2><span class="section-number">18.2. </span>keyboard features<a class="headerlink" href="#keyboard-features" title="Link to this heading">¶</a></h2>
<p>The current mapping in the kernel is provided by the map_p1k_to_key
function:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>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, #,
</pre></div>
</div>
<p>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.</p>
</section>
<section id="lcd-features">
<h2><span class="section-number">18.3. </span>LCD features<a class="headerlink" href="#lcd-features" title="Link to this heading">¶</a></h2>
<p>The LCD is divided and organised as a 3 line display:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> |[] [][] [][] [][] 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
</pre></div>
</div>
<dl>
<dt>Format description:</dt><dd><p>From a userspace perspective the world is separated into “digits” and “icons”.
A digit can have a character set, an icon can only be ON or OFF.</p>
<p>Format specifier:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>'8' : Generic 7 segment digit with individual addressable segments
Reduced capability 7 segment 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.
</pre></div>
</div>
</dd>
</dl>
</section>
<section id="driver-usage">
<h2><span class="section-number">18.4. </span>Driver usage<a class="headerlink" href="#driver-usage" title="Link to this heading">¶</a></h2>
<p>For userland the following interfaces are available using the sysfs interface:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>/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.
</pre></div>
</div>
<section id="linex">
<h3><span class="section-number">18.4.1. </span>lineX<a class="headerlink" href="#linex" title="Link to this heading">¶</a></h3>
<p>Reading /sys/../lineX will return the format string with its current value.</p>
<blockquote>
<div><p>Example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cat ./line3
888888888888
Linux Rocks!
</pre></div>
</div>
</div></blockquote>
<p>Writing to /sys/../lineX will set the corresponding LCD line.</p>
<blockquote>
<div><ul class="simple">
<li><p>Excess characters are ignored.</p></li>
<li><p>If less characters are written than allowed, the remaining digits are
unchanged.</p></li>
<li><p>The tab ‘t’and ‘n’ char does not overwrite the original content.</p></li>
<li><p>Writing a space to an icon will always hide its content.</p></li>
</ul>
<blockquote>
<div><p>Example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>date +"%m.%e.%k:%M" | sed 's/^0/ /' > ./line1
</pre></div>
</div>
<p>Will update the LCD with the current date & time.</p>
</div></blockquote>
</div></blockquote>
</section>
<section id="get-icons">
<h3><span class="section-number">18.4.2. </span>get_icons<a class="headerlink" href="#get-icons" title="Link to this heading">¶</a></h3>
<p>Reading will return all available icon names and its current settings:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cat ./get_icons
on M
on D
on :
IN
OUT
STORE
NEW
REP
SU
MO
TU
WE
TH
FR
SA
LED
DIALTONE
RINGTONE
</pre></div>
</div>
</section>
<section id="show-hide-icons">
<h3><span class="section-number">18.4.3. </span>show/hide icons<a class="headerlink" href="#show-hide-icons" title="Link to this heading">¶</a></h3>
<p>Writing to these files will update the state of the icon.
Only one icon at a time can be updated.</p>
<p>If an icon is also on a ./lineX the corresponding value is
updated with the first letter of the icon.</p>
<blockquote>
<div><p>Example - light up the store icon:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo -n "STORE" > ./show_icon
cat ./line1
18.e8.M8.88...188
S
</pre></div>
</div>
<p>Example - sound the ringtone for 10 seconds:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo -n RINGTONE > /sys/..../show_icon
sleep 10
echo -n RINGTONE > /sys/..../hide_icon
</pre></div>
</div>
</div></blockquote>
</section>
</section>
<section id="sound-features">
<h2><span class="section-number">18.5. </span>Sound features<a class="headerlink" href="#sound-features" title="Link to this heading">¶</a></h2>
<p>Sound is supported by the ALSA driver: snd_usb_audio</p>
<p>One 16-bit channel with sample and playback rates of 8000 Hz is the practical
limit of the device.</p>
<blockquote>
<div><p>Example - recording test:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>arecord -v -d 10 -r 8000 -f S16_LE -t wav foobar.wav
</pre></div>
</div>
<p>Example - playback test:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>aplay foobar.wav
</pre></div>
</div>
</div></blockquote>
</section>
<section id="troubleshooting">
<h2><span class="section-number">18.6. </span>Troubleshooting<a class="headerlink" href="#troubleshooting" title="Link to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">Q<span class="colon">:</span></dt>
<dd class="field-odd"><p>Module yealink compiled and installed without any problem but phone
is not initialized and does not react to any actions.</p>
</dd>
<dt class="field-even">A<span class="colon">:</span></dt>
<dd class="field-even"><p>If you see something like:
hiddev0: USB HID v1.00 Device [Yealink Network Technology Ltd. VOIP USB Phone
in dmesg, it means that the hid driver has grabbed the device first. Try to
load module yealink before any other usb hid driver. Please see the
instructions provided by your distribution on module configuration.</p>
</dd>
<dt class="field-odd">Q<span class="colon">:</span></dt>
<dd class="field-odd"><p>Phone is working now (displays version and accepts keypad input) but I can’t
find the sysfs files.</p>
</dd>
<dt class="field-even">A<span class="colon">:</span></dt>
<dd class="field-even"><p>The sysfs files are located on the particular usb endpoint. On most
distributions you can do: “find /sys/ -name get_icons” for a hint.</p>
</dd>
</dl>
</section>
<section id="credits-acknowledgments">
<h2><span class="section-number">18.7. </span>Credits & Acknowledgments<a class="headerlink" href="#credits-acknowledgments" title="Link to this heading">¶</a></h2>
<blockquote>
<div><ul class="simple">
<li><p>Olivier Vandorpe, for starting the usbb2k-api project doing much of
the reverse engineering.</p></li>
<li><p>Martin Diehl, for pointing out how to handle USB memory allocation.</p></li>
<li><p>Dmitry Torokhov, for the numerous code reviews and suggestions.</p></li>
</ul>
</div></blockquote>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../../_sources/input/devices/yealink.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>