From: Glynn Clements <glynn-yNl2PdEqlWR9KcvjrzN2WNBPR1lH4CV8@public.gmane.org>
To: jhammond-qGaTmy9+pjn8wb0/L2CcF0B+6BGkLq7r@public.gmane.org
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-c-programming-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Accessing USB thermometer sensor
Date: Sat, 21 Jun 2008 10:02:35 +0100 [thread overview]
Message-ID: <18524.50091.552123.924329@cerise.gclements.plus.com> (raw)
In-Reply-To: <1f60185ec2ee200f67d7a12ee6cbf2fb.squirrel-2RFepEojUI3piBo0p4lDPw@public.gmane.org>
Josh Hammond wrote:
> >> usb 1-2.2: pl2303 converter now attached to ttyUSB0
> >
> > Does "cat /dev/ttyUSB0" work?
>
> Nope. I get only blank
Thinking about it some more, if the device is outputting binary, the
line buffering performed by the TTY driver and stdio will get in the
way. How about:
stty raw < /dev/ttyUSB0
dd if=/dev/ttyUSB0 bs=1 | od -t x1 -w1
Or, in C:
int fd;
struct termios t;
fd = open("/dev/ttyUSB0", O_RDONLY|O_NOCTTY);
tcgetattr(fd, &t);
cfmakeraw(&t);
tcsetattr(fd, TCSANOW, &t);
for (;;) {
unsigned char buf[1];
if (read(fd, buf, 1) <= 0)
break;
printf("%02x\n", *buf);
}
close(fd);
--
Glynn Clements <glynn-yNl2PdEqlWR9KcvjrzN2WNBPR1lH4CV8@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-06-21 9:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-20 13:28 Accessing USB thermometer sensor Josh Hammond
2008-06-20 16:44 ` Glynn Clements
[not found] ` <18523.56941.116797.23150-o3XtBhA/DwwNEGAfyhIZ+pATpRlcFRyyAL8bYrjMMd8@public.gmane.org>
2008-06-20 16:50 ` Josh Hammond
[not found] ` <1f60185ec2ee200f67d7a12ee6cbf2fb.squirrel-2RFepEojUI3piBo0p4lDPw@public.gmane.org>
2008-06-21 9:02 ` Glynn Clements [this message]
2008-06-20 21:32 ` Chris Doré
2008-06-23 7:20 ` Tosoni
-- strict thread matches above, loose matches on Subject: below --
2008-06-24 7:18 Josh Hammond
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18524.50091.552123.924329@cerise.gclements.plus.com \
--to=glynn-ynl2pdeqlwr9kcvjrzn2wnbpr1lh4cv8@public.gmane.org \
--cc=jhammond-qGaTmy9+pjn8wb0/L2CcF0B+6BGkLq7r@public.gmane.org \
--cc=linux-c-programming-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox