2006/4/6, Johan Hedberg <[EMAIL PROTECTED]>: > 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
_______________________________________________ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers