Scott Edwards wrote:
Behold echo -e and quotes. works with single or double quotes.
Very nice. I thought I had tried -e, but apparently I failed. Thanks for
the info.
--Dave
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the
Byron Clark wrote:
On Tue, Feb 23, 2010 at 09:04:18AM -0700, Dave Smith wrote:
Has anyone gotten a USB device that requires Virtual COM Port support
to work in Linux? I'm considering employing this relay[1] to perform a
nightly reboot of my pile-of-junk Comcast cable modem.
It looks like
On Mon, Mar 15, 2010 at 10:40 AM, Dave Smith d...@thesmithfam.org wrote:
Byron Clark wrote:
On Tue, Feb 23, 2010 at 09:04:18AM -0700, Dave Smith wrote:
Has anyone gotten a USB device that requires Virtual COM Port support
to work in Linux? I'm considering employing this relay[1] to perform a
Andrew McNabb wrote:
Write that to myscript.py and your one-liner is myscript.py. :) Python
really isn't about one-liners. Fortunately, modern Linux distributions
come with filesystems, so creating files is easy. :)
Well, that's what I did, and it looks like this, which is nice:
# cat
On Mon, 2010-03-15 at 11:40 -0600, Dave Smith wrote:
f=open(/dev/ttyUSB0,wb)
for byte in [0xff, 0x01, 0x00]:
f.write(chr(byte))
f.close()
(Is there a one-liner to do this?)
$ python -c with open('/tmp/foo', 'w') as f: map(f.write, [chr(x) for x
in (0xff, 0x01, 0x00)])
$ od
echo -n \xff\x01\x00 /dev/ttyUSB0
Sorry, correction:
echo $'\xff\x01\x00' /dev/ttyUSB0
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/
On Mon, Mar 15, 2010 at 12:00 PM, Stuart Jansen sjan...@buscaluz.orgwrote:
On Mon, 2010-03-15 at 11:40 -0600, Dave Smith wrote:
f=open(/dev/ttyUSB0,wb)
for byte in [0xff, 0x01, 0x00]:
f.write(chr(byte))
f.close()
(Is there a one-liner to do this?)
I have Comcast's
Nicholas Leippe wrote:
echo $'\xff\x01\x00' /dev/ttyUSB0
That's what I was looking for. I didn't escape the 'x' when I tried
initially.
--Dave
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/
Dave Smith wrote:
That's what I was looking for. I didn't escape the 'x' when I tried
initially.
Actually, that appears to not work as I expected. The first problem is
that echo needs -n to *not* print a newline character, which would not
normally be a problem (but for purity's sake I added
On Mon, 2010-03-15 at 12:32 -0600, Dave Smith wrote:
Dave Smith wrote:
That's what I was looking for. I didn't escape the 'x' when I tried
initially.
Actually, that appears to not work as I expected. The first problem is
that echo needs -n to *not* print a newline character, which would
Stuart Jansen wrote:
Because echo is merely processing its argv and the '\0' is seen as
terminating the arg, not part of the arg.
So the shell is parsing the $'\x' and turning it into a binary blob for
echo? That makes sense.
--Dave
/*
PLUG: http://plug.org, #utah on irc.freenode.net
On Mon, 2010-03-15 at 12:32 -0600, Dave Smith wrote:
After it failed to turn on the relay, here's what I did to
investigate:
echo -n $'\xff\x01\x00' /tmp/foo.txt
hexdump -C /tmp/foo.txt
000 ff 01
And ls -l confirms that the file is only 2 bytes in size (not 3 as I
expected). Is it
On Mon, Mar 15, 2010 at 12:32:40PM -0600, Dave Smith wrote:
Actually, that appears to not work as I expected. The first problem is
that echo needs -n to *not* print a newline character, which would not
normally be a problem (but for purity's sake I added -n). The second
problem is that
On Mon, Mar 15, 2010 at 11:57:33AM -0600, Dave Smith wrote:
Well, that's what I did, and it looks like this, which is nice:
# cat reboot-comcast-cable-modem
#!/bin/bash
relay-off
sleep 10
relay-on
By the way, I would probably merge these into the Python script. Then
you
Andrew McNabb wrote:
This is exactly why I only use shell scripts for very simple tasks. :)
Well, I got it to work, and I learned something about command line
argument parsing in the process. Here's what I ended up with, and I
looked over it, and it was good:
# cat reboot-cable-modem
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/
On Mon, 2010-03-15 at 13:58 -0600, Dave Smith wrote:
Andrew McNabb wrote:
This is exactly why I only use shell scripts for very simple tasks. :)
Well, I got it to work, and I learned something about command line
argument parsing in the process. Here's what I ended up with, and I
looked
Stuart Jansen wrote:
#!/bin/bash
DELAY=10
DEVICE=/dev/ttyUSB0
printf '\xFF\x01\x01' $DEVICE # Power off
sleep $DELAY
printf '\xFF\x01\x00' $DEVICE # Power on
Commit rejected.
Never name a variable that has anything to do with time without using
the units in the name:
-DELAY=10
Behold echo -e and quotes. works with single or double quotes.
supap...@li:~$ echo -en \xFF\x01\x00 junk
supap...@li:~$ hd junk
ff 01 00 |...|
0003
supap...@li:~$ echo -en '\xFF\x01\x00' junk
supap...@li:~$ hd junk
ff 01 00
Has anyone gotten a USB device that requires Virtual COM Port support
to work in Linux? I'm considering employing this relay[1] to perform a
nightly reboot of my pile-of-junk Comcast cable modem.
--Dave
[1] http://www.ecrater.com/product.php?pid=4757843
/*
PLUG: http://plug.org, #utah on
Dave Smith wrote:
Has anyone gotten a USB device that requires Virtual COM Port support
to work in Linux? I'm considering employing this relay[1] to perform a
nightly reboot of my pile-of-junk Comcast cable modem.
Assuming the serial controller on that board is supported by Linux, when
you
Shane Hathaway wrote:
Dave Smith wrote:
Has anyone gotten a USB device that requires Virtual COM Port support
to work in Linux? I'm considering employing this relay[1] to perform a
nightly reboot of my pile-of-junk Comcast cable modem.
Assuming the serial controller on that board is
Dave Smith wrote:
That may indeed be a better option, but the hacker in me wants any
excuse to setup a relay and a cron job. :)
Amen.
Shane
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/
On Tue, Feb 23, 2010 at 09:04:18AM -0700, Dave Smith wrote:
Has anyone gotten a USB device that requires Virtual COM Port support
to work in Linux? I'm considering employing this relay[1] to perform a
nightly reboot of my pile-of-junk Comcast cable modem.
It looks like it uses the FTDI chip
Shane Hathaway wrote:
Assuming the serial controller on that board is supported by Linux, when
you plug in the device to a computer running a recent distribution,
you'll get a device called /dev/ttyUSB0, which you can use like an
ordinary serial port.
So I could use minicom to control it?
Byron Clark wrote:
It looks like it uses the FTDI chip so it should work fine with any
2.6.x kernel.
Byron, that's why you make the big bucks. Yeah baby! I just ordered one
-- can't wait to start playing with it.
--Dave
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe:
On Tue, 2010-02-23 at 09:04 -0700, Dave Smith wrote:
Has anyone gotten a USB device that requires Virtual COM Port support
to work in Linux?
I don't know if this works the same way as what you're looking at, but
I've got one of these and it works perfectly right out of the box:
27 matches
Mail list logo