Uniden Home Patrol - Arduino Yun - HPe-rc

Hello All:

I am not sure if i am posting this is the appropriate board or not, but being that I tried this on the Yun; it seems logical that I should post here.

I have been looking for a way to “remote control/remote view” my Uniden Home Patrol Scanner http://www.homepatrol.com/. I ran upon this link http://hp.xoynq.com/. After installing the appropriate files on my SD card , and making sure that the appropriate python libraries are installed on the Yun; it works…but only for a few minutes (if that), and then it becomes unresponsive until I reset the Yun, or “kill” the process using the advanced web configuration which still seems to work. During the troubleshooting, I went to the Yun advanced configuration web page and looked through the processes. It seems that after a minute or two the processor gets to 90-94-95% and that seems to be when the remote control web page stops responding to commands and receiving data from the scanner. Would you guys be able to point me in a direction for further troubleshooting?

Any help is greatly appreciated! Thanks!

Todd

Can you see which process is keeping the CPU so busy? Is it hpe-rc or some other tool from http://hp.xoynq.com/?

As I am not in front of it at the moment I can't check it; although, I am pretty sure that was the process, Yes.

Ok, so I had a few minutes this evening to investigate further, and I found the following:

  1. Fired up the Home Patrol Scanner and connected it to the Yun via USB as before.
    1a) Checked processor percentage for this process, (Process not started yet, so doesn’t show in LuCI.)
  2. Opened up Putty and logged in via SSH, and ran the following command python HPe-rc.py
    2a) Checked the processor percentage and it has not changed from original, however the HPe-rc.py process is now showing.
    2b) In Putty Used the “Open” Command to open the USB port to connect to the Home Patrol
    2c) Went back to Putty, and entered the WEB command to start the HPe-rc webserver.
  3. I opened my web browser and navigated to the page http://{YUNIP}:8000/hpe-rc.html#
    3a) Checked the processor percentage again, and it still has not changed and the process is still running.
  4. Clicked on the “connect” button on the web page.
    4a) immediately upon connecting and displaying the data from the scanner, I noticed the processor percentage was increasing, until around 90% when the web page stops updating, and subsequently not accepting any commands.

As I explained before, I am unable to get this to work any more until I either re-boot the Yun or Kill the process.

Federico, To confirm yes it is “python hpe-rc.py” process.

Thanks for any and all help.

One other item I forgot to mention yesterday:

When you plug in the USB cable to the Home Patrol, you have two options, Serial Port and USB Mass Storage that you have to select by the Home Patrol On Screen Menu.

If the USB cable is plugged in, [u]AND[/u] you have selected Serial port mode on the Home Patrol [u]BEFORE[/u] the Yun Boots up, it seems to force the Home Patrol Scanner into Mass Storage mode. You can avoid this by plugging the USB cable in after the Yun has booted. It appears that this is the only work around.

Does the Yun send some type of "Clear/Reset" command via USB when it is booting up that might be triggering this to happen?

To confirm yes it is "python hpe-rc.py" process.

Before run hpe-rc.py, You could try skip buffering for a whole python process using "python -u" (or#!/usr/bin/env python -u etc) or by setting the environment variable PYTHONUNBUFFERED.

python -u hpe-rc.py

or

export PYTHONUNBUFFERED=true

Sonnyyu, Thanks for the suggestion.

However in my haste to get this working, I think I may have inadvertently caused this project to go backwards. As I noted in a previous post, when you plug the HomePatrol in, it gives you two options. For some reason, now no matter which option I select, it always reboots the HomePatrol in the USB Mass Storage Mode. Interesting enough, I plugged it into a Linux Machine Running Ubuntu (don’t remember the version) and I was able to click Serial Port mode and communicate with the device, and actually ran the python script there for about an hour.

So before I can try Sonnyyu’s suggestion, I need to figure out how to keep the Yun from forcing USB Mass Storage Mode on the HomePatrol.

As always, any and all suggestions are welcome.

Ok, I looked at quite a few sites to determine what was going on here. I found this site http://wiki.openwrt.org/doc/recipes/3gdongle As mentioned in the last post, I was probably hasty in trying to get this to work, and subsequently it appears that I uninstalled the kmod-usb-acm module, among the others listed on that page.

After selecting Serial port mode on the HomePatrol, when I run dmesg now it shows the following:

[  725.920000] cdc_acm 1-1.1:1.0: ttyACM0: USB ACM device

Apparently that was not all I happened to uninstall, because now I am also unable to change to the SD directory.

Does anyone know what modules are required for the SD card to work?

I finally got this back to "normal" after lots of trial and error. I really must have made a mess of this thing trying to fix it.

So after learning that the mount point for the SD card had been deleted? changed? moved? It took quite a few tries to get it back to where it should be. Apparently the mount point should be as follows: /dev/sda1 > /mnt/sd/arduino . I fixed this in LuCI administration page. Once I finally got this back working, I could serve up the web page again. However for some reason the ttyACM0 would not connect to the HomePatrol once running the hpe-rc.py script. I learned that the hotplug2 had been un-installed as well. I re-installed this and now can reconnect to the Home Patrol.

Now that I have this functional again. I have tried sonnyyu's suggestion, however it still seems to do the same thing. The processor didn't ramp up to the 90% +. This time it got to around 75% or so, however the page suffered the same fate as it did the last time. It just stops updating, and all of the buttons on the page stop being functional.

Does anybody have additional suggestions on how to get this to work, or is this processor/memory on the linux side of the Yun not powerful enough?

If nothing else this was quite a learning experience.

There is a parameter that controls how fast the web browser requests updates from HPe-rc. By default, it is set to 200ms which may be too fast for the Arduino to handle. I would recommend starting at 1000 ms (1 second) and experiment from there.

Try set ajax_refresh 1000 before you start the web interface.

If that takes care of the problem, you may want to adjust how often the browser reads global settings and volume/squelch settings. These are set as a multiple of the ajax_refresh value, so they may not get updated often enough when you increase ajax_refresh. In the web directory, open hpe-rc.js, edit the lines that include ajax_refresh*3 and ajax_refresh*4.

I hope this helps. My "expertise" is with HPe-rc and not Arduinos, but I'll try to help if I can.