4

I have a USB Bluetooth dongle mounted (?) as /dev/rfcomm0, and when I navigate to my local IP address from another device on my network in a browser, I want it to write a 't' to the serial port so that it is transmitted over the Bluetooth connection to another module. I also want it to be as fast as possible.

Currently I can do it in PHP with fopen() and fwrite(), but it is far too slow (3 - 5 seconds), and when I connect to the port with minicom, I can send these commands instantly.

Is there a way to maybe keep the com port open, but then be able to write bytes to it asynchronously from a PHP or CGI script?

I am running an Apache web server with PHP on Rasbian (Debian 7.6) on a Raspberry Pi.

Tanner
  • 41

1 Answers1

0

You could do a hack with logging, like this (in your apache config file)

LogFormat "f" bluetooth
CustomLog /dev/rfcomm0 common

I haven't tested it, but it should work.

Also, apache2 + php is killing your Raspberry, I suggest moving to nginx + php-fpm. You could do a similar trick in nginx as well.

Enbyted
  • 101