[maemo-developers] [maemo-developers] Re: Disconnect rfcomm stays between bt_disconnected and rf_disconnected
From: koos vriezen koos.vriezen at gmail.comDate: Thu Apr 6 14:59:09 EEST 2006
- Previous message: [maemo-developers] Re: Disconnect rfcomm stays between bt_disconnected and rf_disconnected
- Next message: [maemo-developers] Re: Disconnect rfcomm stays between bt_disconnected and rf_disconnected
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2006/4/6, Johan Hedberg <johan.hedberg at nokia.com>: > On Thu, Apr 06, 2006, koos vriezen wrote: > > For the short term, it would be helpfull if someone could point to a > > way to disable this device, like w/ offline mode or plastic cover, > > programmaticaly. > > Using the commandline: > hciconfig hci0 down > hciconfig hci0 up When having such a state: Running as root /usr/sbin/hciconfig hci0 down return immediately w/o resetting the device > Or using the HCIDEVDOWN and HCIDEVDOWN ioctl's from C code. #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <sys/ioctl.h> //#include <bluetooth/hci.h> evil header, can't be used standalone /* HCI ioctl defines */ #define HCIDEVUP _IOW('H', 201, int) #define HCIDEVDOWN _IOW('H', 202, int) #define HCIDEVRESET _IOW('H', 203, int) int main (int argc, char ** argv) { if (argc > 1) { int fd = open (argv[1], O_RDWR); if (fd < 0) { perror ("open"); return 1; } if (fd > -1 && ioctl (fd, HCIDEVDOWN)) { fprintf (stderr, "Down fails, trying reset..%d\n", ioctl (fd, HCIDEVRESET)); } close (fd); } return 0; } when running as ./hci-reset /dev/rfcomm0 open: No route to host So far it didn't do what the 'Offline mode' does .. Koos
- Previous message: [maemo-developers] Re: Disconnect rfcomm stays between bt_disconnected and rf_disconnected
- Next message: [maemo-developers] Re: Disconnect rfcomm stays between bt_disconnected and rf_disconnected
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]