Giter VIP home page Giter VIP logo

peripage-a6-bluetooth's Issues

Reverse engineering questions

I'd suggest to add a variable delay in the sending loop so printer will have enough time to print each part of received chunk without hanging

time.sleep(0.05)

In addition Android/ios application should be reverse engineered for more detailed protocol description, variable width printing, e.t.c, but they're obfuscated and shitcoded

print darkness setting

I have discovered that the hex sequence {10 FF 10 00 xx} is the command to set the print darkness. Observed the app using values of 0, 2, or 4; intermediate values seem to work as well. Higher values don't seem to fail, but are not visibly different from 4.

You could add this as a feature, if you like... :)

EDIT:
It seems this command doesn't take effect until after the 12 null sequence is sent. (At least on the A9 I'm testing with. This script fully works with the A9 as far as I have tested. If you wanted to add more support for it, A9 print width is 0x48, 576 dots)

From python to js

Hi,
I love your job! Thank you!
I tried the script this week and it works very well.
I am running the script through a nodejs server which creates a png and sends it to print.
Do you think it is possible to translate python to js using node-bluez ?

MacOs support

Hi! Thanks for your work!
Could you please port it to mac somehow? If that's possible..

error in PyBluez setup command: use_2to3 is invalid.

I got this error in linux Mint

pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
Collecting PyBluez==0.23
  Downloading PyBluez-0.23.tar.gz (97 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.6/97.6 KB 3.2 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in PyBluez setup command: use_2to3 is invalid.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Could it be related to https://stackoverflow.com/questions/69100275/error-while-downloading-the-requirements-using-pip-install-setup-command-use-2 ?

USB Support?

HI, as the printer is also recognized via USB, would it be possible to add Support for printing via USB?

Thanks a lot for considering :-)

Printing error

I get this error when i try to print my image:

klara@raspberrypi:~/peripage-A6-bluetooth $ ./ppa6-print.py -i image.jpg 20:21:01:38:FF:C9
Traceback (most recent call last):
  File "/home/klara/peripage-A6-bluetooth/./ppa6-print.py", line 2, in <module>
    import bluetooth
  File "/home/klara/.local/lib/python3.9/site-packages/bluetooth/__init__.py", line 45, in <module>
    from bluetooth.bluez import *
  File "/home/klara/.local/lib/python3.9/site-packages/bluetooth/bluez.py", line 8, in <module>
    import bluetooth._bluetooth as _bt
ImportError: libbluetooth.so.3: cannot open shared object file: No such file or directory

Why is that? should the image be saved somewhere specific?

Error building pybluez

I have Python 3.10.2 on Windows. Do you have a suggestion why the package pybluez doesn't work?

Building wheels for collected packages: pybluez
  Building wheel for pybluez (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.10
      creating build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\ble.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\bluez.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\btcommon.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\macos.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\msbt.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\__init__.py -> build\lib.win-amd64-3.10\bluetooth
      running build_ext
      building 'bluetooth._msbt' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pybluez
  Running setup.py clean for pybluez
Failed to build pybluez
Installing collected packages: webencodings, tqdm, tinycss2, pycparser, pybluez, Pillow, defusedxml, colorama, qrcode, cssselect2, cffi, cairocffi, cairosvg
  Running setup.py install for pybluez ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pybluez did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.10
      creating build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\ble.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\bluez.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\btcommon.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\macos.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\msbt.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\__init__.py -> build\lib.win-amd64-3.10\bluetooth
      running build_ext
      building 'bluetooth._msbt' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pybluez

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

[notice] A new release of pip available: 22.3.1 -> 24.1.1
[notice] To update, run: python.exe -m pip install --upgrade pip

F:\peripage-A6-bluetooth>python.exe -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\suzanka\appdata\local\programs\python\python310\lib\site-packages (22.3.1)
Collecting pip
  Downloading pip-24.1.1-py3-none-any.whl (1.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 11.6 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.3.1
    Uninstalling pip-22.3.1:
      Successfully uninstalled pip-22.3.1
Successfully installed pip-24.1.1

F:\peripage-A6-bluetooth>pip install -r requirements.txt
Collecting pybluez (from -r requirements.txt (line 1))
  Cloning https://github.com/pybluez/pybluez.git to c:\users\suzanka\appdata\local\temp\pip-install-227rigfg\pybluez_317db7e454ef41b2b2efa42cab6ba32e
  Running command git clone --filter=blob:none --quiet https://github.com/pybluez/pybluez.git 'C:\Users\suzanka\AppData\Local\Temp\pip-install-227rigfg\pybluez_317db7e454ef41b2b2efa42cab6ba32e'
  Resolved https://github.com/pybluez/pybluez.git to commit 82cbba8a1ebd4c1e3442dfafd8581d58c50fa39e
  Preparing metadata (setup.py) ... done
Requirement already satisfied: tqdm==4.59.0 in c:\users\suzanka\appdata\local\programs\python\python310\lib\site-packages (from -r requirements.txt (line 2)) (4.59.0)
Collecting Pillow==9.4.0 (from -r requirements.txt (line 3))
  Downloading Pillow-9.4.0-cp310-cp310-win_amd64.whl.metadata (9.4 kB)
Collecting qrcode==6.1 (from -r requirements.txt (line 4))
  Downloading qrcode-6.1-py2.py3-none-any.whl.metadata (11 kB)
Collecting cairosvg==2.5.2 (from -r requirements.txt (line 5))
  Downloading CairoSVG-2.5.2-py3-none-any.whl.metadata (2.7 kB)
Requirement already satisfied: six in c:\users\suzanka\appdata\local\programs\python\python310\lib\site-packages (from qrcode==6.1->-r requirements.txt (line 4)) (1.16.0)
Collecting colorama (from qrcode==6.1->-r requirements.txt (line 4))
  Downloading colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Collecting cairocffi (from cairosvg==2.5.2->-r requirements.txt (line 5))
  Downloading cairocffi-1.7.1-py3-none-any.whl.metadata (3.3 kB)
Collecting cssselect2 (from cairosvg==2.5.2->-r requirements.txt (line 5))
  Downloading cssselect2-0.7.0-py3-none-any.whl.metadata (2.9 kB)
Collecting defusedxml (from cairosvg==2.5.2->-r requirements.txt (line 5))
  Downloading defusedxml-0.7.1-py2.py3-none-any.whl.metadata (32 kB)
Requirement already satisfied: tinycss2 in c:\users\suzanka\appdata\local\programs\python\python310\lib\site-packages (from cairosvg==2.5.2->-r requirements.txt (line 5)) (1.3.0)
Collecting cffi>=1.1.0 (from cairocffi->cairosvg==2.5.2->-r requirements.txt (line 5))
  Downloading cffi-1.16.0-cp310-cp310-win_amd64.whl.metadata (1.5 kB)
Requirement already satisfied: webencodings in c:\users\suzanka\appdata\local\programs\python\python310\lib\site-packages (from cssselect2->cairosvg==2.5.2->-r requirements.txt (line 5)) (0.5.1)
Requirement already satisfied: pycparser in c:\users\suzanka\appdata\local\programs\python\python310\lib\site-packages (from cffi>=1.1.0->cairocffi->cairosvg==2.5.2->-r requirements.txt (line 5)) (2.22)
Downloading Pillow-9.4.0-cp310-cp310-win_amd64.whl (2.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 MB 12.1 MB/s eta 0:00:00
Downloading qrcode-6.1-py2.py3-none-any.whl (31 kB)
Downloading CairoSVG-2.5.2-py3-none-any.whl (45 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.8/45.8 kB 2.2 MB/s eta 0:00:00
Downloading cairocffi-1.7.1-py3-none-any.whl (75 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 75.6/75.6 kB 4.1 MB/s eta 0:00:00
Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Downloading cssselect2-0.7.0-py3-none-any.whl (15 kB)
Downloading defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Downloading cffi-1.16.0-cp310-cp310-win_amd64.whl (181 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 181.6/181.6 kB 5.5 MB/s eta 0:00:00
Building wheels for collected packages: pybluez
  Building wheel for pybluez (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.10
      creating build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\ble.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\bluez.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\btcommon.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\macos.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\msbt.py -> build\lib.win-amd64-3.10\bluetooth
      copying bluetooth\__init__.py -> build\lib.win-amd64-3.10\bluetooth
      running build_ext
      building 'bluetooth._msbt' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pybluez
  Running setup.py clean for pybluez
Failed to build pybluez
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pybluez)

Implement script command to change serial number

@bitrate16 figured out that the S/N can be changed via a command:

Using the poke method i've found out that it has additional configuration commands, but now i've lost ability to print text and get S/N

UPD: S/N break code 10ff20f4
UPD2: Write [0x10ff20f4, 'S/N'] will overwrite S/N with new value 'S/N'. String has to be terminated with '\0'
UPD3: 10ffff** configures print modes
UPD4: I don't understand it, sending any raw string makes printer print it

_Originally posted by @bitrate16 in https://github.com/eliasweingaertner/peripage-A6-bluetooth/issues/1#issuecomment-803662260_

Goal of this issue to make this functionality available from the script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.