[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [bluetooth-dev] BT_CTRL_TTY & /dev/ttyBTx ..!
The control TTY (ttyBTC) is only used to send IOCTL:s to the driver, it
can be opened several times.
The ttyBTx-devices are used to send/receive data from the driver and can
only be open by one process
at the same time. Typically the control tty is used by a daemon to check
for incoming connections and
then it uses the ttyBTx-devices to send and receive data.
Line is the identifier for the ttyBT, so ttyBT0 = line 0.
I'm not sure why you need to parse the procfile, have a look at the
in btdm.c. An example how you open the device and send data can be found
in btsend.c. I haven't
analyzed the parsing code below but if you manage to get the correct tty
which is connected you
shall be able to send data with the method you are using below.
> -----Original Message-----
> From: owner-bluetooth-dev On Behalf Of axis
> Sent: den 9 januari 2004 10:42
> To: Bluetooth-dev
> Subject: [bluetooth-dev] BT_CTRL_TTY & /dev/ttyBTx ..!
> Could anyone please tell me the difference between
> BT_CTRL_TTY and /dev/ttyBTx.Do we need to use both at the same time?
> And is "line" the "x" in /dev/ttyBTx ? If so is the
> following code correct for opening the tty and sending the
> data to my device from access point.
> Please have a look at lines marked ****** and your help
> in this regard will be very helpful for my Masters Thesis.
> Thank you
> ****** if((bt_cfd = bt_openctrl()) < 0)
> perror("Could not open BT Control device");
> printf("Stack not initianted ,exit\n");
> printf("Reading proc file\n");
> ****** pFile = fopen("/proc/bt_channel_con","r");
> if(pFile == 0)
> ****** temp = fread(buffer, 5, 1, pFile);
> printf("Connect on bt_cfd %d,temp %d buffer %s line
> %c\n", bt_cfd,temp,buffer,buffer);
> t1 = (char *)malloc(sizeof(char));
> t2 = (char *)malloc(sizeof(char));
> ***** line = atoi(t1);
> ***** srv_ch = atoi(t2);
> ***** if(bt_isconnected(bt_cfd,line))
> *(int*)bd_addr = line;
> if(ioctl(bt_cfd, BTREADREMOTEBDADDR, bd_addr) <
> tty = buffer;
> printf("The tty is %s\n",tty);
> ***** fd = open_device(tty,O_RDWR,0);
> printf("Device file descriptor %d\n",fd);
> ***** if(write(fd,buffer,5) != 5)
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> To unsubscribe from this list: send the line "unsubscribe
> bluetooth-dev" in the body of a message to email@example.com
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to firstname.lastname@example.org