Peter Ward avatar Peter Ward committed 89420c1

add pjlink post

Comments (0)

Files changed (1)

content/software/controlling-projectors-with-pjlink.rst

+Controlling Projectors with PJLink
+##################################
+:date: 2012-11-30 22:41
+
+I regularly need to control a data projector, and previously the only way to do
+this has been using a web interface created by the manufacturer.
+Of course the interface is, while usable, poorly designed, and somewhat
+sluggish.
+
+Fortunately, there’s a protocol for controlling projectors, PJLink_,
+but unfortunately, there aren’t many implementations
+(I did find a `perl module`_ in my search),
+so I decided to write my own implementation in Python.
+
+`So I did`_, and it took me just a single morning, which I was quite impressed
+with. The specification is reasonable simple, and aside from one or two stupid
+mistakes, implementing it was straight forward.
+In addition to the Python API, I also wrote a simple command line utility for
+communicating with the projector, which is probably more useful than the API
+(since you can throw it into your own shell scripts).
+
+If you want to try it out, you can install it from `PyPI`_ using pip.
+
+.. code-block:: sh
+
+    $ pip install --user pjlink
+    # or if you're in a virtualenv
+    $ pip install pjlink
+
+The location of projectors can be specified in ~/.config/pjlink/pjlink.conf
+(on Linux, see `appdirs`_ for your platform):
+
+.. code-block:: ini
+
+    [default]
+    host = myprojector
+    port = 4212
+    password = JBMIAProjectorLink
+
+    [other]
+    host = bob
+
+Note this stores your passwords in plain text: this is an indication of what I
+think of the authentication protocol which PJLink uses. I couldn’t find a
+specific vulnerability, but I still wouldn’t trust it.
+
+Then, you can use -p to reference the projector in the config file.
+You can also just specify a host and port manually (but not a password).
+
+.. code-block:: sh
+
+    # get power state of myprojector:4212 (using password)
+    $ pjlink -p default power
+    # get power state of bob:4352 (default port, no password)
+    $ pjlink -p other power
+
+    # for the "default" projector, you can omit -p
+    # this is the same as the first command
+    $ pjlink power
+
+    # get available inputs
+    $ pjlink inputs
+
+    # get current input
+    $ pjlink input
+
+    # switch to input RGB-1
+    $ pjlink input RGB 1
+
+And there are many more commands available: everything in the specification is
+implemented as plainly as possible, so if the projector can do it, my tool
+supports it.
+
+And for the record, I disclaim any responsibility for inappropriate use of this
+tool. (because I can think of a few!)
+
+.. _PJLink: http://pjlink.jbmia.or.jp/english/
+.. _`perl module`: http://search.cpan.org/dist/Net-PJLink/lib/Net/PJLink.pm
+.. _`So I did`: http://hg.flowblok.id.au/pjlink
+.. _`PyPI`: http://pypi.python.org/pypi/pjlink
+.. _`appdirs`: http://pypi.python.org/pypi/appdirs
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.