|
|
@ -6,9 +6,11 @@ |
|
|
|
# https://www.sertronics-shop.de/computer/pc-peripheriegeraete/usb-gadgets/led-name-tag-11x44-pixel-usb |
|
|
|
# https://www.sertronics-shop.de/computer/pc-peripheriegeraete/usb-gadgets/led-name-tag-11x44-pixel-usb |
|
|
|
# The font_11x44[] data was downloaded from such a device. |
|
|
|
# The font_11x44[] data was downloaded from such a device. |
|
|
|
# |
|
|
|
# |
|
|
|
|
|
|
|
# Requires: |
|
|
|
|
|
|
|
# sudo apt-get install python3-evdev |
|
|
|
|
|
|
|
|
|
|
|
import sys, os |
|
|
|
import sys, os, array, time |
|
|
|
|
|
|
|
import usb.core |
|
|
|
|
|
|
|
|
|
|
|
font_11x44 = ( |
|
|
|
font_11x44 = ( |
|
|
|
0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, |
|
|
|
0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, |
|
|
@ -37,6 +39,7 @@ font_11x44 = ( |
|
|
|
0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, |
|
|
|
0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, |
|
|
|
0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00, |
|
|
|
0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00, |
|
|
|
0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x62, 0xc6, 0xfe, 0x00, |
|
|
|
0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x62, 0xc6, 0xfe, 0x00, |
|
|
|
|
|
|
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00, |
|
|
|
0x00, 0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, |
|
|
|
0x00, 0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, |
|
|
@ -63,6 +66,7 @@ font_11x44 = ( |
|
|
|
0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, |
|
|
|
0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, |
|
|
|
0x00, 0x00, 0x00, 0x00, 0xfe, 0x8c, 0x18, 0x30, 0x62, 0xfe, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0x00, 0xfe, 0x8c, 0x18, 0x30, 0x62, 0xfe, 0x00, |
|
|
|
|
|
|
|
|
|
|
|
0x00, 0x7c, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0xc6, 0x7c, 0x00, |
|
|
|
0x00, 0x7c, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0xc6, 0x7c, 0x00, |
|
|
|
0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, |
|
|
|
0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, |
|
|
|
0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, |
|
|
|
0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, |
|
|
@ -112,12 +116,21 @@ font_11x44 = ( |
|
|
|
0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
0x00, 0xcc, 0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00, |
|
|
|
|
|
|
|
0x00, 0xc6, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, |
|
|
|
|
|
|
|
0x00, 0xcc, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
0xc6, 0xc6, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, |
|
|
|
|
|
|
|
0xc6, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, |
|
|
|
|
|
|
|
0xc6, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, |
|
|
|
|
|
|
|
0x00, 0x3c, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x6c, 0x60, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
charmap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + \ |
|
|
|
charmap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + \ |
|
|
|
'abcdefghijklmnopqrstuvwxyz' + \ |
|
|
|
'abcdefghijklmnopqrstuvwxyz' + \ |
|
|
|
'0987654321^ !"\0$%&/()=?` \\}][{' + \ |
|
|
|
'0987654321^ !"\0$%&/()=?` °\\}][{' + \ |
|
|
|
"@ ~ |<>,;.:-_#'+* " |
|
|
|
"@ ~ |<>,;.:-_#'+* " + "äöüÄÖÜß" |
|
|
|
|
|
|
|
|
|
|
|
char_offset = {} |
|
|
|
char_offset = {} |
|
|
|
for i in range(len(charmap)): |
|
|
|
for i in range(len(charmap)): |
|
|
@ -138,18 +151,48 @@ proto_header = ( |
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
def header(lengths): |
|
|
|
def header(args): |
|
|
|
""" lengths[0] is the number of chars of the first text |
|
|
|
""" len(args[0]) is the number of chars of the first text |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
lengths = [] |
|
|
|
|
|
|
|
for l in range(len(args)): |
|
|
|
|
|
|
|
lengths.append(len(args[l])) |
|
|
|
|
|
|
|
|
|
|
|
h = list(proto_header) |
|
|
|
h = list(proto_header) |
|
|
|
for i in range(len(lengths)): |
|
|
|
for i in range(len(lengths)): |
|
|
|
h[17+2*i] = lengths[i] |
|
|
|
h[17+2*i] = lengths[i] |
|
|
|
return h |
|
|
|
return h |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(sys.argv) < 2: |
|
|
|
|
|
|
|
print("Usage:\n\n %s Message1 [Message2 .. 8]\n" % (sys.argv[0])) |
|
|
|
|
|
|
|
sys.exit(0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dev = usb.core.find(idVendor=0x0416, idProduct=0x5020) |
|
|
|
|
|
|
|
if dev is None: |
|
|
|
|
|
|
|
print("No led tag with vendorID 0x0416 and productID 0x5020 found.") |
|
|
|
|
|
|
|
print("Connect the led tag and run this tool as root.") |
|
|
|
|
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
if dev.is_kernel_driver_active(0): |
|
|
|
|
|
|
|
dev.detach_kernel_driver(0) |
|
|
|
|
|
|
|
dev.set_configuration() |
|
|
|
|
|
|
|
print("using [%s %s] bus=%d dev=%d" % (dev.manufacturer, dev.product, dev.bus, dev.address)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
buf = array.array('B') |
|
|
|
|
|
|
|
buf.extend(header(sys.argv[1:])) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for text in sys.argv[1:]: |
|
|
|
|
|
|
|
# print(text) |
|
|
|
|
|
|
|
for c in text: |
|
|
|
|
|
|
|
# print(bitmap(c)) |
|
|
|
|
|
|
|
buf.extend(bitmap(c)) |
|
|
|
|
|
|
|
|
|
|
|
text = sys.argv[1] |
|
|
|
needpadding = len(buf)%64 |
|
|
|
|
|
|
|
if needpadding: |
|
|
|
|
|
|
|
buf.extend( (0,) * (64-needpadding) ) |
|
|
|
|
|
|
|
|
|
|
|
print(text) |
|
|
|
# print(buf) |
|
|
|
print(header([len(text),0,0,0])) |
|
|
|
for i in range(int(len(buf)/64)): |
|
|
|
for c in text: print(bitmap(c)) |
|
|
|
time.sleep(0.1) |
|
|
|
|
|
|
|
dev.write(1, buf[i*64:i*64+64]) |
|
|
|
|
|
|
|
|
|
|
|