DOC update documentation on installation and CLI
This commit is contained in:
parent
80b714fdae
commit
fd3f1067fe
|
@ -12,7 +12,6 @@ Content
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
:caption: User Documentation
|
:caption: User Documentation
|
||||||
|
|
||||||
user/dependencies
|
|
||||||
user/installation
|
user/installation
|
||||||
user/methods
|
user/methods
|
||||||
user/printers
|
user/printers
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
************
|
|
||||||
Dependencies
|
|
||||||
************
|
|
||||||
|
|
||||||
Fedora
|
|
||||||
------
|
|
||||||
|
|
||||||
Fortunately everything is on Fedora repositories.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
# yum install python-imaging pyserial pyusb python-qrcode
|
|
||||||
|
|
||||||
Ubuntu
|
|
||||||
------
|
|
||||||
|
|
||||||
Ultimately, this instructions also apply to Raspbian, in case you are
|
|
||||||
interested to install python-escpos on your Raspberry with Raspbian.
|
|
||||||
|
|
||||||
Install the packages available on distro repositories.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
# apt-get install python-imaging pyserial
|
|
||||||
|
|
||||||
The packages which are not available at Ubuntu repositories need to be
|
|
||||||
installed manually.
|
|
||||||
|
|
||||||
pyusb
|
|
||||||
^^^^^
|
|
||||||
This is the python binding to libusb-1.0
|
|
||||||
|
|
||||||
* Get the latest tarball from `sourceforge <http://sourceforge.net/projects/pyusb/files/PyUSB%201.0/>`__
|
|
||||||
* Build and install it
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
# tar zxvf pyusb-1.*.tar.gz
|
|
||||||
# cd pyusb-1.*
|
|
||||||
# python setup.py build
|
|
||||||
# sudo python setup.py install
|
|
||||||
|
|
||||||
python-qrcode
|
|
||||||
^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
This is the python module to generate QR Codes
|
|
||||||
|
|
||||||
* Checkout the latest code from `github <https://github.com/lincolnloop/python-qrcode>`__
|
|
||||||
* Build and install it
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
# git clone https://github.com/lincolnloop/python-qrcode
|
|
||||||
# cd python-qrcode
|
|
||||||
# python setup.py build
|
|
||||||
# sudo python setup.py install
|
|
||||||
|
|
|
@ -2,16 +2,26 @@
|
||||||
Installation
|
Installation
|
||||||
************
|
************
|
||||||
|
|
||||||
System preparation
|
:Last Reviewed: 2016-07-23
|
||||||
------------------
|
|
||||||
|
|
||||||
1. Install the required
|
Installation with PIP
|
||||||
`dependencies <https://github.com/manpaz/python-escpos/wiki/Dependencies>`__
|
---------------------
|
||||||
|
Installation should be rather straight-forward. python-escpos is on PyPi, so you can simply enter:
|
||||||
|
|
||||||
2. Get the *Product ID* and *Vendor ID* from the lsusb command
|
::
|
||||||
|
|
||||||
|
pip install python-escpos
|
||||||
|
|
||||||
|
This should install all necessary dependencies. Apart from that python-escpos should also be
|
||||||
|
available as a Debian package. If you want to always benefit from the newest stable releases you should probably
|
||||||
|
install from PyPi.
|
||||||
|
|
||||||
|
Setup udev for USB-Printers
|
||||||
|
---------------------------
|
||||||
|
1. Get the *Product ID* and *Vendor ID* from the lsusb command
|
||||||
``# lsusb Bus 002 Device 001: ID 1a2b:1a2b Device name``
|
``# lsusb Bus 002 Device 001: ID 1a2b:1a2b Device name``
|
||||||
|
|
||||||
3. Create a udev rule to let users belonging to *dialout* group use the
|
2. Create a udev rule to let users belonging to *dialout* group use the
|
||||||
printer. You can create the file
|
printer. You can create the file
|
||||||
``/etc/udev/rules.d/99-escpos.rules`` and add the following:
|
``/etc/udev/rules.d/99-escpos.rules`` and add the following:
|
||||||
``SUBSYSTEM=="usb", ATTRS{idVendor}=="1a2b", ATTRS{idProduct}=="1a2b", MODE="0664", GROUP="dialout"``
|
``SUBSYSTEM=="usb", ATTRS{idVendor}=="1a2b", ATTRS{idProduct}=="1a2b", MODE="0664", GROUP="dialout"``
|
||||||
|
@ -20,21 +30,19 @@ System preparation
|
||||||
"dialout" group, or use another group you already belongs instead
|
"dialout" group, or use another group you already belongs instead
|
||||||
"dialout" and set it in the ``GROUP`` parameter in the above rule.
|
"dialout" and set it in the ``GROUP`` parameter in the above rule.
|
||||||
|
|
||||||
4. Restart udev ``# sudo service udev restart`` In some new systems it
|
3. Restart udev ``# sudo service udev restart`` In some new systems it
|
||||||
is done with ``# sudo udevadm control --reload``
|
is done with ``# sudo udevadm control --reload``
|
||||||
|
|
||||||
Install
|
Enabling tab-completion in CLI
|
||||||
-------
|
------------------------------
|
||||||
|
python-escpos has a CLI with tab-completion. This is realised with ``argcomplete``.
|
||||||
|
In order for this to work you have to enable tab-completion, which is described in
|
||||||
|
the `manual of argcomplete <https://argcomplete.readthedocs.io>`__.
|
||||||
|
|
||||||
* Clone python-escpos from github
|
If you only want to enable it for python-escpos, or global activation does not work, try this:
|
||||||
* Change directory to python-escpos and install the package
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
# cd python-escpos
|
eval "$(register-python-argcomplete python-escpos)"
|
||||||
# python setup.py build
|
|
||||||
# sudo python setup.py install
|
|
||||||
|
|
||||||
* Enjoy !!!
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue