cups ignores -o raw option when printing using lpr to remote printer - zebra-printers

Cups 1.6.3 printer setup on the network on computer #1.
Zebra Label Printer using Zebra EPL2 driver
device for labelq: usb://Zebra%20Technologies/ZTC%20ZD420-203dpi%20ZPL?serial=D2J175123456
On computer #2 cups autodetects:
When I run lpstat -t it says:
device for labelq: implicitclass:labelq
When I execute " lpr -P labelq -oraw rawprintercommands.txt," cups rasterizes the file and converts it to a pdf. Therefore instead of getting a nice label, I get printercode on the label.
1) Why will cups not print in raw mode when I call the following?
lpr -P labelq -oraw rawprintercommands.txt
I tried explicitly adding the printer on computer #2 as a raw printer and that works, but the whole auto setup with implicit class, I also expect to work when I use the -o raw option. I need this to work in over 1000 sites.

Try lp -d labelq -o raw rawprintercommands.txt

Related

Run an alias based on output of another command

My laptop for option to switch fan speeds. So to change fan speed when it is plugged in, i want to write a alias to to detect if it is plugged in and check the fan speed accordingly.
To check if battery is plugged in, i have used command
acpi -a
which gives output of either off-line or online so based on this, i want to execute my alias.
Aliases I have created to switch fan speed is
alias fan-turbo='cd /sys/devices/platform/asus-nb-wmi; sudo sh -c "echo 1 >> fan_boost_mode"; sudo sh -c "echo 1 >> throttle_thermal_policy"; source ~/.bashrc;'
My approach was to get output and search for off-line using Grep, but don't know how to proceed.

Linux shell: save input line from Serial Port each minute and send to remote server

I have Arduino connected to computer over RS-232 (only TxD, RxD and GND).
Arduino only send data to computer and computer receive it. Computer do not transmit anything to Arduino.
Computer is WiFi router with OpenWrt linux with 16MB RAM and 4MB flash for system. I do not have free enough space for "good tool" like python (I have the same working program on x86 PC written in python).
Arduino send data to PC +- each 60 seconds. Data has following format:
SENSOR1;12.34;95.47
ABC245;34.5;75.1
2 sensors each have 2 values. Line is ended using <CR><LF>. I can modify this "protocol" to for example one line like (or any other):
SENSOR1;12.34;95.47|ABC245;34.5;75.1
so on wifi router I need little program which read this string every minute and save it to variable. This variable insert to curl and send to remote server. Can I send data to server without curl (with less ram/flash usage)?
I would like to use pure bysybox sh (bash is to big).
I found Bash script: save stream from Serial Port (/dev/ttyUSB0) to file until a specific input (e.g. eof) appears :
#!/bin/bash
while read line; do
if [ "$line" != "EOF" ]; then
echo "$line" >> file.txt
else
break
fi
done < /dev/ttyUSB0
awk `
/EOF/ {exit;}
{print;}` < /dev/ttyUSB0 > file.txt
is it good choice to use/modify these script? Is there any other better solution?
Why not give a try to ser2net pakage?
This will allow forward the serial port to the server.
It work ok on OpenWrt
Lua is buid in.
A script in Lua ca read also from the serial port , but you neet to set the port parameters first with stty
stty 9600 raw < /dev/ttyUSB0
lua myscript < /dev/ttyUSB0

Automate xmodem file upload

I have a device where a software update is done by uploading a file through xmodem.
I was able to do this in two ways using the lrzsz (http://ohse.de/uwe/software/lrzsz.html) package.
1) Using screen
screen /dev/tty.myserialdevice 115200
and then
^A:exec !! sz -X file.bin
or
2) Using cu
cu -l /dev/tty.myserialdevice -s 115200
and then
~+lsz -X file.bin
Now I would like to write a script (preferably a ruby or a bash script) to automate the file upload.
Is there a way to pipe the file into screen or cu or use standard input?
When I tried to write a script I only got to the point of opening a connection.
But even then I had problems to properly close this connection again.
Not sure if you are still having this problem, but I just recently had to piece together something for a similar situation.
I used screen to automate this portion, as it has some command line options to run in the background. First, I create a detached screen session, like this:
screen -d -m /dev/tty.myserialdevice 115200
Then, I can reference my created session with the -p0 option, and give it a command to execute with -X, which in this case is a command to screen itself to start an xmodem file transfer.
screen -p0 -X exec \!\! sz -X filetosend
I had noticed in other places on the web that .\!\! was also sometimes used, so keep this in mind to try if you still have problems.

How to manage windows wifi in ruby?

I have been looking for a library(or just sample code) to manage windows wifi. I have found a few for linux using commands, but windows doesn't offer a way like that.
Im looking a simple list networks, be able to tell whether open/wep/wpa, pass password as an argument, etc.
If you invoke the netsh tool you should probably be able to do most of what you want to do. For example, to dump all the visible networks, run:
netsh wlan show networks
#! /usr/bin/ruby
# save this file as: "~/iwlist.rb"
# make executable: chmod +x ~/.iwlist.rb
# execute with: "~/iwlist.rb"
rpt= %x[iwlist wlan0 scan]
str=''
rpt.each_line{|line| str << (l.chomp + "\n") if /.*(Cell|Quality|Channel|ESSID| Authentication).*/ =~ l }
puts str

Kick out cash drawer from Firefox on Ubuntu through Epson TM88iv

I'm working with a kiosk application, and need to kick out cash drawer #1 from an epson t88iv. I need to be able to do this without printing anything, and from firefox on the ubuntu platform.
Any clues? Cash drawer kicks out right now on every print (from print settings), but this is not desired.
Thanks a lot,
Mark
Standard Linux command to open drawer of the TM-T88IV
USB printer: echo -e -n "\x1b\x70\x30\x40\x50" > /dev/usb/lp0
Network CUPS Printer: echo -e -n "\x1b\x70\x30\x40\x50" | lpr -o raw -P Epson-TM-Network
Since the t88iv is ESC/POS compatible you could read the reference for the protocol
http://www.mscashdrawer.com/Tech_Information/m80pm.pdf
Ps. On the OpenBravo reference: here are the tech specs/supported devices:
http://wiki.openbravo.com/wiki/Projects/POS/Technical_Specifications

Resources