Compare commits
3 Commits
5de6b107d2
...
718f81b8e7
Author | SHA1 | Date |
---|---|---|
Hendrik Schutter | 718f81b8e7 | |
Hendrik Schutter | 94bb43f8cd | |
Hendrik Schutter | 58c5c98265 |
|
@ -33,8 +33,9 @@ systemctl enable --now /lib/systemd/system/reHDDPrinter.service
|
|||
- Brother QL-570
|
||||
- Paper With: 62mm or 696px
|
||||
|
||||
**Hint: Some Brother printers have enabled standby mode. This will disconnect the printer. See [Issue #12](https://git.mosad.xyz/localhorst/reHDDPrinter/issues/12) to disable standby.**
|
||||
|
||||
see https://github.com/pklaus/brother_ql
|
||||
see https://github.com/pklaus/brother_ql for details for printer access
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import sysv_ipc
|
||||
import pycstruct
|
||||
import os
|
||||
import time
|
||||
from brother_ql.brother_ql_create import create_label
|
||||
from brother_ql.raster import BrotherQLRaster
|
||||
import layouter
|
||||
|
@ -17,6 +18,7 @@ str_buffer_size = 64 #keep this synchronous to reHDD
|
|||
msg_queue_key = 0x1B11193C0 #keep this synchronous to reHDD
|
||||
|
||||
file_name = "output.png"
|
||||
printer_path = "/dev/usb/lp0"
|
||||
|
||||
def get_struct_format():
|
||||
#keep this synchronous to struct in reHDD
|
||||
|
@ -57,10 +59,15 @@ def main():
|
|||
shred_timestamp=int(driveData['driveShredTimestamp']),\
|
||||
shred_duration=int(driveData['driveShredDuration']))
|
||||
|
||||
while(not os.path.exists(printer_path)):
|
||||
print("Printer not found, waiting ...")
|
||||
time.sleep(30) #sleep 30
|
||||
|
||||
layouter.generate_image(drive, rehdd_info, file_name)
|
||||
qlr = BrotherQLRaster("QL-570")
|
||||
create_label(qlr, file_name, '62')
|
||||
with open("/dev/usb/lp0", 'wb') as file:
|
||||
|
||||
with open(printer_path, 'wb') as file:
|
||||
file.write(qlr.data)
|
||||
os.remove(file_name)
|
||||
except sysv_ipc.ExistentialError:
|
||||
|
|
Loading…
Reference in New Issue