Hi Grahame,
> Once I have established that USB state has changed I run a script
> system("/usr/sbin/bluetooth_up");
>
>
> #!/bin/sh
> /sbin/ifdown usb0 || true
> /etc/init.d/S30bluetooth stop || true
>
> This runs OK but when it comes time to connect the bluetooth I get:
>
> link_key_request (sba=00:80:37:2E:26:49, dba=00:11:67:58:B3:F1)
> Connect to 00:11:67:58:B3:F1 failed. Inappropriate ioctl for device(25)
>
> However if I run the same script from the command line it works OK
> On the other side bringing up usb0 works OK.
>
> Is there some special way of running this sort of thing via system()???
There could be a few things that are happening.
1 - The environment from within a daemon is often different than what
you get on the command line. By environment, I mean the current
directory (every process has its own current directory) the
environment variables, and the lack or precense of a controlling
terminal.
2 - The timing could be off. The script can enter commands much faster
than you can do on the command line, and sometimes the timing is
different. Try adding a sleep command at the beginning of the script.
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/
|