Skip to content

Instantly share code, notes, and snippets.

@LeoDJ
Created July 16, 2023 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeoDJ/09403d046f9fb2449d00ce3646f06eb2 to your computer and use it in GitHub Desktop.
Save LeoDJ/09403d046f9fb2449d00ce3646f06eb2 to your computer and use it in GitHub Desktop.
Python script to control/open a Partner Tech SP-850 cash drawer
# Control a Partner Tech SP-850 cash drawer
# Needs root
import portio
import time
# request permission to I/O port range
portio.ioperm(0x5a8, 4, 1)
# Has to be 32bit access, otherwise the EC won't respond
def open_drawer():
portio.outl(0xFF, 0x5a8) # (val, port)
time.sleep(0.05)
portio.outl(0xFE, 0x5a8) # bit 0 -> 0 open drawer A, bit 1 -> B
time.sleep(0.05)
portio.outl(0xFF, 0x5a8) # reset to 1 according to manual
def is_drawer_open():
return not (portio.inl(0x5a8) & 0x40)
if __name__ == "__main__":
open_drawer()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment