Re: Virtual COM port on Linux

2010-03-16 Thread Dave Smith
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

Re: Virtual COM port on Linux

2010-03-15 Thread Dave Smith
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

Re: Virtual COM port on Linux

2010-03-15 Thread Nicholas Leippe
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

Re: Virtual COM port on Linux

2010-03-15 Thread Dave Smith
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

Re: Virtual COM port on Linux

2010-03-15 Thread Stuart Jansen
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

Re: Virtual COM port on Linux

2010-03-15 Thread Nicholas Leippe
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. */

Re: Virtual COM port on Linux

2010-03-15 Thread Scott Jones
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

Re: Virtual COM port on Linux

2010-03-15 Thread Dave Smith
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. */

Re: Virtual COM port on Linux

2010-03-15 Thread Dave Smith
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

Re: Virtual COM port on Linux

2010-03-15 Thread Stuart Jansen
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

Re: Virtual COM port on Linux

2010-03-15 Thread Dave Smith
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

Re: Virtual COM port on Linux

2010-03-15 Thread Stuart Jansen
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

Re: Virtual COM port on Linux

2010-03-15 Thread Andrew McNabb
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

Re: Virtual COM port on Linux

2010-03-15 Thread Andrew McNabb
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

Re: Virtual COM port on Linux

2010-03-15 Thread Dave Smith
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

Re: Virtual COM port on Linux

2010-03-15 Thread Jessie Morris
/* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */

Re: Virtual COM port on Linux

2010-03-15 Thread Stuart Jansen
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

Re: Virtual COM port on Linux

2010-03-15 Thread Dave Smith
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

Re: Virtual COM port on Linux

2010-03-15 Thread Scott Edwards
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

Virtual COM port on Linux

2010-02-23 Thread Dave Smith
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

Re: Virtual COM port on Linux

2010-02-23 Thread Shane Hathaway
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

Re: Virtual COM port on Linux

2010-02-23 Thread Dave Smith
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

Re: Virtual COM port on Linux

2010-02-23 Thread Shane Hathaway
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. */

Re: Virtual COM port on Linux

2010-02-23 Thread Byron Clark
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

Re: Virtual COM port on Linux

2010-02-23 Thread Dave Smith
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?

Re: Virtual COM port on Linux

2010-02-23 Thread Dave Smith
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:

Re: Virtual COM port on Linux

2010-02-23 Thread Brian Simons
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: