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 pe
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
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:
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
> lo
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/
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
#!
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. Th
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 tha
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
> expecte
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
Unsub
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, whic
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
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.
*/
On Mon, Mar 15, 2010 at 12:00 PM, Stuart Jansen wrote:
> 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 SMC80
>
> 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, 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)
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, Mar 15, 2010 at 10:40 AM, Dave Smith 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
>>> nightly
On Mon, Mar 15, 2010 at 11:40:12AM -0600, Dave Smith wrote:
>
> The part arrived today and after a few minutes of hacking, it works
> beautifully. I didn't have to install or configure anything for
> /dev/ttyUSB0 to appear. And now I have a very simple python script that
> can turn the relay on
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 l
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:
http://www.a
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: http:/
On Tue, Feb 23, 2010 at 10:10:14AM -0700, Dave Smith wrote:
> I would love to write a bash script as simple as this:
>
>reboot-cable-modem.sh:
>#!/bin/bash
>echo 0 > /dev/ttyUSB0
>sleep 5
>echo 1 > /dev/ttyUSB0
>
> Do you think it would be that simple?
Here are the example co
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 i
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 c
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.
*/
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 boar
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
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 irc
29 matches
Mail list logo