2006-11-06 08:46:33

by shantibhushan sale

[permalink] [raw]
Subject: [Bluez-devel] BT

Can i get any info how about Bluetooth On/OFF.I tried a program that doesnt
help out much for me.Does anyone help me here.
Here is this program which works as hciconfig hci0 up

int start_device(uint16_t dev_id)
{
struct hci_dev *dev;
struct hci_version ver;
uint8_t features[8], inqmode;
int dd;

ASSERT_DEV_ID;

dev = &devices[dev_id];

if (dev->ignore)
return 0;

dd = hci_open_dev(dev_id);
if (dd < 0) {
error("Can't open device hci%d",
dev_id, strerror(errno), errno);
return -errno;
}

if (hci_read_local_version(dd, &ver, 1000) < 0) {
int err = errno;
error("Can't read version info for hci%d: %s (%d)",
dev_id, strerror(errno), errno);
hci_close_dev(dd);
return -err;
}

dev->hci_rev = ver.hci_rev;
dev->lmp_ver = ver.lmp_ver;
dev->lmp_subver = ver.lmp_subver;
dev->manufacturer = ver.manufacturer;

if (hci_read_local_features(dd, features, 1000) < 0) {
int err = errno;
error("Can't read features for hci%d: %s (%d)",
dev_id, strerror(errno), errno);
hci_close_dev(dd);
return -err;
}

memcpy(dev->features, features, 8);

inqmode = get_inquiry_mode(dev);
if (inqmode < 1)
goto done;

if (hci_write_inquiry_mode(dd, inqmode, 1000) < 0) {
int err = errno;
error("Can't write inquiry mode for hci%d: %s (%d)",
dev_id, strerror(errno), errno);
hci_close_dev(dd);
return -err;
}

done:
hci_close_dev(dd);

printf("Device hci%d has been activated", dev_id);

return 0;
}


Attachments:
(No filename) (1.65 kB)
(No filename) (3.09 kB)
(No filename) (373.00 B)
(No filename) (164.00 B)
Download all attachments

2006-11-06 15:03:59

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] BT

Hi,

> Can i get any info how about Bluetooth On/OFF.I tried a program that
> doesnt help out much for me.Does anyone help me here.
> Here is this program which works as hciconfig hci0 up

no it doesn't. This piece of code is a copy from hcid/device.c and not
related to "hciconfig hci0 up". Activating a Bluetooth adapter is a
kernel task.

Regards

Marcel



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel