Page 1 of 1

Problems after restarting Bubba2 (USB and autostart)

Posted: 10 Apr 2010, 01:39
by redw0001
Can anybody help me with resolution to either of the following problems please?

I group them together as they happen together to one program. First this occurs when I have to restart my Bubba2 which isnt often but does happen. I have a program I run called MisterHouse which is written in Perl. MisterHouse is a home automation program and runs just fine on my Bubba2 and talks to my weather station and X10 controller via serial ports. To allow this to happen I use serial-USB converters.

Problem 1:
After a restart of my Bubba2 I cannot get Misterhouse to automatically start, I have a script that runs fine from a command line but I'm unclear what I need to do to make it run automatically on reboot of the Bubba2. I did the same thing as I used to do from my Suse machine but that does not work.

Problem 2:
When I start it manually I find that the USB ports have changed. Normally they are /dev/ttyUSB0 and /dev/ttyUSB1 but I cannot predict which is the X10 controller and which is the weather. Is it possible to stop the Bubba2 changing the USB port mapping?

Re: Problems after restarting Bubba2 (USB and autostart)

Posted: 10 Apr 2010, 09:18
by 6feet5
Hi,

I haven't installed misterhouse fully yet myself, so this is untested, but you need to copy bin/misterhouse.rc (in the misterhouse tar file) to /etc/init.d/misterhouse. Then (as root) issue the command

Code: Select all

update-rc.d misterhouse default
You may have to change the PGM path in misterhouse.rc first (the script expect to find mh in /usr/local/bin/misterhouse/bin/ folder)

To solve your second problem, create udev rules that make symbolic links to the devices. Read my howto about how to automatically start a backup when a USB harddisk is connected, to find out how to identify your two USB devices. Using the attributes you got, create a similar rule file containing one rule for each device, but instead of the RUN+=command command, you use SYMLINK+=name.
The weather station rule might look something like (all on one line):

Code: Select all

SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{manufacturer}=="SomeManufacturer", ATTRS{product}=="Cool product", SYMLINK+=weatherstation
This rule should create a symbolic link named /dev/weatherstation that will point at the correct device node. You can then use this device name instead of the /dev/ttyUSB#, it will always point at the right one. Note that you need to reboot or issue the command udevtrigger before the link appears.

/Johan