How to disable sleep mode on Zebra printer i.e. ZD410 - zebra-printers

I am working with ZD410 printer to print labels in one of my project. When I turn on ZD410 printer, after some time printer goes to sleep mode and power button is blinking. My requirement is my printer never goes to sleep mode. Please suggest any idea. Thanks in advance. I have tried few ideas but not luck.
What I have tried is
Procedure1:
Install "Zebra Printer Setup Utility" mobile app in android.
Connect ZD410 printer to this zebra printer setup utility app.
Send below commands via .txt file to the connected printer:
! U1 setvar "power.energy_star.enable" "off"
! U1 setvar "power.energy_star.timeout" "0"
or
! U1 setvar "power.sleep.enable" "off"
! U1 setvar "power.sleep.timeout" "0"
Printer received file successfully with getting any error but printer will not return any thing and sleep mode is not disabled.
Procedure2:
Install "Zebra Printer Setup Utility" windows software.
Connect ZD410 printer to windows with USB cabel.
Run zebra printer setup utility software and select connected printer.
Send below commands to the connected printer:
! U1 setvar "power.energy_star.enable" "off"
! U1 setvar "power.energy_star.timeout" "0"
or
! U1 setvar "power.sleep.enable" "off"
! U1 setvar "power.sleep.timeout" "0"
Printer will not return any thing and sleep mode is not disabled.

When you use a setvar command, the printer never return anything; if the command is correct, the settings is simply changed.
What you can do to check if the setting has actually been changed, is to use the same commmand but with a getvar instructions.
I.E.
! U1 getvar "power.energy_star.enable"
will show "on" or "off" according to the current status of this setting.
What is important to know, with the SGD commands, is that you must always add a carriage return after the last line, otherwise the command will not be processed by the printer, so in your case you should send
! U1 setvar "power.energy_star.enable" "off"
In addition, this command is correct, but some of the oldest firmware doesn't allow you to turn off the sleep mode so to check this, you can get the allcv report and check what option you have beside "power.energy_star.enable": if you see nothing, you must first upgrade the firmware because the latest one allows you to turn the sleep mode off using the command you're trying to use.

Related

Toggling the Wi-Fi with XF86WLAN and script

I have the following script (in my PATH):
#!/usr/bin/env bash
main()
{
local state=$(sudo rfkill list wifi -n -o SOFT)
if [[ $state == 'blocked' ]]
then
sudo rfkill unblock wifi
state='Unblocked'
else
sudo rfkill block wifi
state='Blocked'
fi
notify-send 'Wi-Fi' "$state"
exit 0
}
main $#
Running the script from the command line works as expected, then I add the following shortcut to my.xbindkeysrc:
"kill-wifi"
XF86WLAN
But the notifications, and the Wi-Fi interface get stuck in one of the two states, blocked or unblocked, it doesn't toggle. Sometimes, if I press several times the XF86WLAN key, I get a toggle.
The weird thing is that using another key to trigger the script, such as F8, the whole thing works fine, but I want to leave F8 for purposes other than toggling the WiFi.
So one of my guesses was that there's "something" binding the XF86LAN KeySym that messes up when my script runs. But then commenting out the command that actually kills the WiFi interface, produces the right notifications (but I'm not actually doing anything useful).
Any pointers would be appreciated.
Aaaanyways, for anyone in my same situation, install urfkill which automatically listen for the XF86WLAN event.
Then in your script, simply produce the notification:
#!/usr/bin/env bash
main()
{
local state=$(sudo rfkill list wifi -n -o SOFT)
notify-send "Wi-Fi" "$state"
}
main
Note that the script uses another utility named rfkill only for getting the state of the Wi-Fi interface, and spit it in the notification.
Finally in your .xbindkeysrc:
"kill-wifi"
XF86WLAN
You could be using other hotkeys daemon like sxhkd or even the configuration file of i3 or sway, in any case your shell script only is used for notify the state of the Wifi interface, the real work of toggling the Wifi on and off is done by urfkill.
The good news is that now that button with the little antena symbol on your laptop actually toggles on/off your Wi-Fi card and you still have free to use the underlying Function key (F8 in my case) ;-)
P.S. If anyone reads this and knows why my first approach was failing (race condition or whatever), please feel free to let me know how to solve it.

Opening serial connection to Arduino through Bash

I have set up my Arduino so when I send a "0" via the serial monitor, a stepper motor turns a given amount.
I want to include this in a bash script, but I can only get this to work when the arduino serial monitor is open and entering echo 0 > /dev/tty.usbserial641 in bash. I assume this is because serial monitor is opening the connection for me.
In my struggle to open the connection in bash (without serial monitor open) I have tried all manner of options with stty -f /dev/tty.usbserial641 and have also tried connecting reset to ground with a 10uF capacitor.
Can any help me open the connection in bash without the use of arduino serial monitor?
System:
Arduino Uno rev3
OS X 10.8.4
Many thanks,
hcaw
Do the commands below work for you.
# stty -F /dev/ttyUSB0 9600 cs8 -cstopb
# sleep 0.1
# echo "0" > /dev/ttyUSB0
There is a difference between the value 0 and the ascii char 0 (48). Which one you trying to send, and which one are you trying to receive?
If you want to read the port from the terminal you can do it like this
head -n 1 /dev/ttyUSB0 //the number after n is how many lines you want to read
As a last note, I am a fan of pySerial. I would much rather write an interface in python than shell scripts.
I found a great binary written in C that solves my problem called Arduino-serial. Here's the link.
I hope this helps people with similar problems!

Mac 'screen' command shell script

I'm working on an i/o project where I have a microcontroller that communicates with my mac through a serial terminal using the screen command in Terminal.app
For example, to open the connection I type "screen /dev/tty.usbserial-number 115200" and then can type commands/data that are sent to the microcontroller
I would like to write a shell script, applescript, c program, or something simple like that that initiates the connection, sends the number "16" and then closes the connection
Thanks
Why do you need to use 'screen'? Can't you just do something like "stty -F 115200 /dev/ttyS0 ; echo '16' >/dev/ttyS0" ? Is there something specific about the setup?

How can I send a string to serial /dev/tty.* port, delay a second, disconnect from the port and continue my bash script in OSX?

This is in relation to resetting an Arduino, and then start pushing data to it from my usb xbee.
I've tried using screen, with no luck.
screen -S Xbee -d -m /dev/tty.usbserial-A900fra9 115200 *reset
I don't know how to close this session, not sure whether the args are correct, either.
to send anything to devices on /dev, you can use the > >> 2> 2>&1, etc.
Try this example from tty1 (ctrl+alt+F1):
echo "my string" > /dev/tty2
now go to tty2 (alt+F2) and you gonna see your string. It should work with any device.
and to sleep, use:
sleep 1
your problem could be also with permissions. Try it with root! ;)

How to set the baud rate for Macs in a terminal

Is it possible to set the baud rate for Macs in a terminal? If yes, how to set the baud rate in terminal through the terminal?
I am trying to talk to the Mac using an Arduino (open source microcontroller), an XBee (wireless communicator) to type in the terminal through the serial monitor. The only problem I am having is the baud rate of the serial monitor and terminal are different. I can easily change the baud rate for the serial monitor in the Arduino, but I do not know what the baud rate is for the terminal in Mac.
On Mac OS, stty seemingly can only change terminal settings for an ongoing access.
It works to either:
Access the serial interface, e.g. cat /dev/cu.usbserial, the default settings will be used at first. On a different terminal use stty, e.g. stty -f /dev/cu.usbserial 230400 to set the baud rate, the settings of the terminal accessed before will change.
There is a small time window after executing stty, in which the access can be performed with the desired parameters, e.g. stty -f /dev/cu.usbserial 230400 & cat /dev/cu.usbserial executes stty, detaches it and then immediately performs the access to the serial device.
For one line command logging serial port /dev/tty.usbserial-X's output to cat.out and terminating the logging by pressing Ctrl+C, here is the solution: trap 'kill $(jobs -p)' SIGINT ; cat /dev/tty.usbserial-X | tee cat.out & stty -f /dev/tty.usbserial-X 115200. You can type Ctrl+C to terminate logging to cat.out. (edited)
This only seems to work for the /dev/cu.* device files. I don't know the difference from /dev/tty.* files.
Minicom is an excellent tool that does exactly what you're asking for. You can get it using apt on ubuntu but should check this Tutorial out for Mac.
Keep the serial reset issue in mind if you plan on sending data to the Arduino. see http://arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection
stty 19200 or so.
Check man stty, you can set stop bits, speed, etc.
Surprised that no one mentioned picocom which could set higher bard rate up to 4000000.

Resources