From: Pierre-Yves Paulus <py@idlum.be>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] Switch virtual TTY (/dev/rfcomm0) to RAW mode
Date: Wed, 20 Dec 2006 09:24:32 +0100 [thread overview]
Message-ID: <4588F340.3000003@idlum.be> (raw)
Hello,
I'm writing a simple Java application which performs an OBEX push, using
a Java OBEX implementation, and not OpenOBEX "as usual".
All my application is making use of the DBus API to find the device, and
to get a virtual TTY (/dev/rfcommX) connected to the remote devices's
OPP channel. It is working very well.
However, before I can start the OBEX session over /dev/rfcommX, I've to
switch it into RAW mode, as I learnt it on this list previously. I think
I've got a problem at this step. I'm using the following piece of C code
to put /dev/rfcomm0 into RAW mode (from a JNI call):
// Open the file (representing the virtual TTY)
FILE *stream = NULL;
stream = fopen(filename, "r");
if (!stream) {
printf("Unable to open file!\n");
exit(-1);
}
// Get its identifier
int fid = fileno(stream);
struct termio old_term;
struct termio new_term;
// Get the current config of the TTY
if (ioctl(fid, TCGETA, &old_term) == -1) {
printf("ioctl get failed.\n");
exit(-2);
}
// Change what has to be.
new_term = old_term;
new_term.c_lflag &= ~ICANON;
new_term.c_cc[VMIN] = 0;
new_term.c_cc[VTIME] = 0;
// Apply
if (ioctl(fid, TCSETA, &new_term) == -1) {
printf("ioctl set failed.\n");
exit(-3);
}
// Close the file
fclose(stream);
Is it the right way to perform this, or am I doing something wrong
there? Needless to say I'm very new to this tty stuff, and may have done
something really stupid, in which case I would like to know it.
Thanks in advance,
Best Regards,
Pierre-Yves
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
reply other threads:[~2006-12-20 8:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4588F340.3000003@idlum.be \
--to=py@idlum.be \
--cc=bluez-devel@lists.sourceforge.net \
/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