ttyS0 problem
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi marcel,
=D4=DA 2005-10-10=D2=BB=B5=C4 09:13 +0800=A3=ACdavid=D0=B4=B5=C0=A3=BA
Quoted 28 lines
Hi David,
=20Quoted 18 lines
I want to write some commands to the uart(ttyS0), but it fails. The steps are as follows:
=20
1. hciattach ttyS0 texas
2. Open ttyS0 device again and get a fd, init ttyS0 with speed,flow_ctland so on,then write a command(0x30) to the fd but return 0; That is nothing is written to ttyS0.
=20
If I write the same command in the functiontexas(int fd, struct uart_t *u, struct termios *ti), it succeeds.
From bluez-utiles I see the following code which maybe the reason why I can't write the command to ttyS0 after running hciattach ttyS0 texas.
=20
/* Set TTY toN_HCIline discipline */
i =3DN_HCI;
if (ioctl(fd, TIOCSETD, &i)< 0) {
perror("Can't set line discipline");Quoted 8 lines
return -1;
}
=20
It seems the codes is very important ,because if I delete these codes, the following codes can't run any more.
=20
Is there any method that I can write the command to the ttyS0 successfully after step 1?
Quoted 7 lines
=20
after step 1, you must use the HCI raw socket to send commands. What commands do you wanna send?
=20
Regards
=20
Marcel
=20
Quoted 1 line
What commands do you wanna send?
The command is HCI_GO_TO_SLEEP_IND(0x30) which is only one byte. It is a vendor specific command used to ask the BT device to go to sleep. If BT device receives the command, maybe it would response HCILL_GO_TO_SLEEP_ACK(0x31) command to the host.
Quoted 1 line
after step 1, you must use the HCI raw socket to send commands
Is this means we cannot write command to ttyS0 directly through write() function?
Regards
David
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi David,
Quoted 5 lines
Quoted 1 line
What commands do you wanna send?
The command is
HCI_GO_TO_SLEEP_IND(0x30)which is only one byte. It is a vendor specific command used to ask the BT device to go to sleep. If BT device receives the command, maybe it would responseHCILL_GO_TO_SLEEP_ACK(0x31)command to the host.
do you have the specification of these vendor commands? Is this command according to the HCI specification or is it an extension of the H:4 transport protocol?
Quoted 4 lines
Quoted 1 line
after step 1, you must use the HCI raw socket to send commands
Is this means we cannot write command to ttyS0 directly through
write()function?
After calling hciattach the kernel takes over the serial port via the line discipline and the reads and writes are useless.
Regards
Marcel
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel