2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

PRESENCE: use "w" parameter when busybox ps is used in mode local-bluetooth

git-svn-id: https://svn.fhem.de/fhem/trunk@4319 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2013-12-03 17:28:44 +00:00
parent 005a5bcb3e
commit c8b0d369b8

View File

@ -666,6 +666,19 @@ PRESENCE_DoLocalBluetoothScan($)
my $return;
my $wait = 1;
my $ps;
my $psargs = "ax";
if(qx(ps --help 2>&1) =~ /BusyBox/g)
{
Log3 $name, 5, "PRESENCE ($name): found busybox variant of ps command, using \"w\" as parameter";
$psargs = "w";
}
else
{
Log3 $name, 5, "PRESENCE ($name): found standard variant of ps command, using \"ax\" as parameter";
$psargs = "ax";
}
Log3 $name, 4, "PRESENCE ($name): 'which hcitool' returns: $hcitool";
chomp $hcitool;
@ -675,7 +688,7 @@ PRESENCE_DoLocalBluetoothScan($)
{
while($wait)
{ # check if another hcitool process is running
$ps = qx(ps ax | grep hcitool | grep -v grep);
$ps = qx(ps $psargs | grep hcitool | grep -v grep);
if(not $ps =~ /^\s*$/)
{
# sleep between 1 and 5 seconds and try again