Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Matthew

Pages: 1 [2] 3
16
Developers / LMCE/MisterHouse Perl Glue
« on: December 26, 2007, 08:47:38 pm »
This topic is the continuation of the "Re: LinuxMCE and Misterhouse topic started in the Users forum.

The current Perl code being debugged:
Code: [Select]
# Category=Pluto
#
#@ Connection with Pluto DCE Router via TCP port localhost:3450 (mh.ini -> pluto_DCE_router).


# strict Perl syntax
use strict;


# Use timer.
$restartTimer = new Timer;


if($Startup)
{
        print_log "Starting connection to LMCE";
        set $restartTimer 10, sub {connect_lmce;};
}


if
(
        inactive_now($pluto_device_event_receiver) ||
        inactive_now($pluto_device_command_sender)
)
{
        print_log "Connection to LMCE terminated, restarting";
        set $restartTimer 10, sub {connect_lmce;};
}


# Should parenthesize &&/|| expressions to make precedence explicit
if(new_minute 1 && !active $pluto_device_event_receiver || new_minute 1 && !active $pluto_device_command_sender)
{
        print_log "Connection to LMCE still terminated, restarting";
        connect_lmce();
}


#my $motion=0;

if(my($msg) = said($pluto_device_event_receiver))
{ # Process message.
        print_log "Pluto Device Message received: $msg\n";

        # Remove quotes before splitting on whitespace.
        $msg =~ s/[\"\']//g;

        #############################################################
        # message Parameters as ordered fields
        #############################################################
        # $1    $2      $3      $4      $5      $6      $7      $8
        # from  to      msgtype msgid   p1id    p1val   p2id    p2val
        #############################################################
        # Example command from orbiter
        # 69    206     1       192     97      ""      98      ""
        # 69    206     1       193     97      ""
        # 69    205     1       184     76      "100"
        # Example command from admin site
        # 0     204     1       760     10      "C2"    154     "192"
        # 0     204     1       760     10      "C2"    154     "193"
        #############################################################

        # Decode message into required and optional fields as validation.
        my
        (
                $reqFieldsPat = '(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)';
                $optFieldsPat = '\s*(\w*)\s*(\w*)';
        );
        if
        (
                my
                (
                        # required fields
                        $deviceFrom, $deviceTo, $msgType, $msgId,
                        $param1Id, $param1Value,

                        # optional fields
                        $param2Id, $param2Value
                )
                = ($msg =~ /$reqFieldsPat$optFieldsPat/)
        )
        { # Process valid message.
                %msgTypes =
                {
                        '1' => 'Command',
                        '2' => 'Event'
                };
                $msgType .=
                        ': ' . defined($msgTypes{$msgType})?
                                        $msgTypes{$msgType} : 'unknown type';

                # Log required fields.
                print_log <<EOT;
DeviceFrom: $deviceFrom
DeviceTo: $deviceTo
MsgType: $msgType
MsgId: $msgId
param1id: $param1Id
param2value: $param1Val
EOT

                # Log optional fields.
                if(defined($param2Id))
                {
                        print_log "param2id: $$param2Id";
                        print_log 'param2value: ' .
                                (defined($param2Val))? $param2Val : 'undefined';
                }

                # Use X10 ID as target.
                my($target);
                my $x10_id;
                %dev2x10 =
                { # device ID to X10 ID
                        '162' => 'A5',
                        '186' => 'A3',
                        '187' => 'B1',
                        '188' => 'A8',
                        '189' => 'B3',
                        '190' => 'B4',
                        '191' => 'A10',
                        '192' => 'A9',
                        '218' => 'A6'
                }; # dev2x10

                $x10_id = $dev2x10{$deviceTo};
                if(defined($x10_id))
                {
                        $target = new X10_Item($x10_id);
                }

                # Probably can convert arbitrary msgID / setting rules
                #   to %msg2Setting if they're exclusive and regular.
                if($msgId eq '760' )
                { # new item in param1
                        $target = new X10_Item($param1Val);
                }


                # Execute message on target.
                if($msgId eq '192' || $param2Val eq '192')
                { # ON
                  print_log "Turn device $x10_id ON";
                  set $target ON;
                }
                if($msgId eq '193' || $param2Val eq '193')
                { # OFF
                  print_log "Turn device $x10_id OFF";
                  set $target OFF;
                }
                if($msgId eq '184')
                { # in param1
                  print_log "Setting device $x10_id to $param1Val%";
                  set $target "$param1Val%";
                }
        } # Process message.
}


my(%motionStates) =
{
        'MOTION' => '0',
        'STILL' => '1'
};
my(%motionLocation2DeviceId) =
{
        $Hall_Motion => '183',
        $Landing_Motion => '184',
        $Kitchen_Motion => '185'
};
my(@motionLocations) = keys(motionLocation2DeviceId);
foreach my($motionLocation) (@motionLocations)
{
        if($state = state_now($motionLocation)
        {
                lmce_motion($motionStates{$state}, $motionLocation);
        }
}


# subs ########################################################################

sub connect_lmce
{
        print_log "Configuring sockets";
        $pluto_device_event_receiver =
                new  Socket_Item(undef, undef, '192.168.1.1:3450','device_event_receiver','tcp','record');
        $pluto_device_command_sender =
                new  Socket_Item(undef, undef, '192.168.1.1:3450','device_command_sender','tcp','record');


        print_log "Closing sockets if any left open";
        if(active_now($pluto_device_event_receiver))
        {
                stop($pluto_device_event_receiver);
        }
        if(active_now($pluto_device_command_sender))
        {
                stop($pluto_device_command_sender);
        }


        print_log "Open and setup new sockets";
        start($pluto_device_event_receiver);
        set $pluto_device_event_receiver "COMMAND 179";

        start($pluto_device_command_sender);
        set $pluto_device_command_sender "EVENT 179";
        set $pluto_device_command_sender "PLAIN_TEXT";
}


sub send_pluto_message
{
        my($message) = @_;


        set $pluto_device_command_sender "MESSAGET " . length($message);
        set $pluto_device_command_sender $message;
}


sub update_temp
{
        my($sensor, $temp) = @_;


        # Example message@
        # 167=temp sensor ID, 2=event, 25=event ID (temp changed), 30=value, temperature (string)
        # my($message) = "167 -1000 2 25 30 $random_number.2";


        # Map iButtons to lmce device numbers.
        my(%sensorId2LMCEDeviceId) =
        {
                0 => 166,
                1 => 167
        }
        my($lmce_device) = $sensorId2LMCEDeviceId{$sensor};

        my($message) = "$lmce_device -1000 2 25 30 $temp.2";
        send_pluto_message($message);
        print_log "Updating sensor $lmce_device $temp";
}


sub lmce_motion
{
        my($motionState, $device_id) = @_;


        # 6780=Detector ID, 2=event, 9=event ID (tripped), 25=tripped value, 1=value (tripped 0=OFF || 1=ON)
        my($message) = "$device_id -1000 2 9 25 $motionState";
        send_pluto_message($message);
}

Here's some new reported functionality, and an upgrade to the original code (not the revised  code version in this message) that needs to be added to the current code revision:
By the way, I've now seen an even shorter message from the DCERouter to switch a light off:

69    218     1       193

This means we now have 3 ways the DCERouter may ask us to switch off a light:

69 218 1 193
69 218 1 193 97 ""
0 204 1 760 10 "C2" 154 "193"

God knows why!

Changes to code:

Code: [Select]
        if ($msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)/ or $msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)/
                        or $msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)/ ) {
                print_log "DeviceFrom: $1";
                print_log "DeviceTo: $2";
                print_log "MsgType: $3 (1=Command, 2=Event)";
                print_log "MsgId: $4";
                if (defined $5) { print_log "param1id: $5";}
                if (defined $6) { print_log "param2value: $6";}
                if (defined $7) { print_log "param2id: $7";}
                if (defined $8) { print_log "param2value: $8";}

                #############################################################
                # $1    $2      $3      $4      $5      $6      $7      $8
                # from  to      msgtype msgid   p1id    p1val   p2id    p2val
                # Example command from orbiter
                # 69    206     1       192     97      ""      98      ""
                # 69    206     1       193     97      ""
                # 69    205     1       184     76      "100"
                # 69    218     1       193
                # Example command from admin site
                # 0     204     1       760     10      "C2"    154     "192"
                # 0     204     1       760     10      "C2"    154     "193"
                #############################################################

17
Developers / Better Name for "0710"?
« on: December 23, 2007, 12:15:07 am »
LMCE "0710" is now being beta tested, and release is imminent. It's called "0710" because it's based on Ubuntu 0710. But the Ubuntu version is named that because it was released in "2007/10" (October 2007), which satisfies both incremental version numbers and recalls just when it dates from. This new version of LMCE will not be released until 2008, and it's different from the previous version more because of LMCE project work than from upgrades in the underlying Ubuntu OS.

So maybe we shouldn't call it "0710", which names the version after both a date and a component that don't define it. Maybe LMCE should do what Ubuntu does, and name the release after the date it's actually released, padded with zeroes. In a year or so, a name like "0801" will mean a lot more than "0710".

18
Developers / 0710 Beta NOW AVAILABLE
« on: December 22, 2007, 10:57:05 pm »
As mentioned by DanielK on the dev maillist[/], and as [url=http://forum.linuxmce.org/index.php?topic=3528.msg18943#msg18943]reported by hari, the LMCE v0710b2 is now available for download:

http://vt100.at/kubuntu-linuxmce-0710-i386-beta-2.iso.torrent

install went fine, testing is still pending. The faint hearted may want to try it. Don't blame me if it burns your kitchen sink.

best regards and happy christmas,
Hari

ps: there will be no final release till after christmas

Please test and report in Mantis any relevant details on any existing issues. Or if, after searching those existing issues, you know you have identified a new issue, please report a new issue.

If we test and report, then the actual release will be much more stable much quicker.

Thanks, Santa!

19
Users / 0710 Beta NOW AVAILABLE
« on: December 22, 2007, 10:56:42 pm »
As mentioned by DanielK on the dev maillist, and as reported by hari, the LMCE v0710b2 is now available for download:

http://vt100.at/kubuntu-linuxmce-0710-i386-beta-2.iso.torrent

install went fine, testing is still pending. The faint hearted may want to try it. Don't blame me if it burns your kitchen sink.

best regards and happy christmas,
Hari

ps: there will be no final release till after christmas

Please test and report in Mantis any relevant details on any existing issues. Or if, after searching those existing issues, you know you have identified a new issue, please report a new issue.

If we test and report, then the actual release will be much more stable much quicker.

Thanks, Santa!

20
Users / Single -> Double NIC... No Adminsite [RESOLVED]
« on: December 18, 2007, 03:13:12 pm »
I switched back from a single NIC setup to double NIC, and now I can't access (with some weird exceptions) the LMCE hybrid on its external interface.

I had switched my LMCE to a Single NIC and it was working fine (no LMCE devices, just a hybrid). But I want to start testing/using my Cisco 7970 IP hardphone, which needs to netboot, so I decided to go with the (LMCE default) double-NIC setup. I installed a 3Com 3C905C-TX PCI card in the machine (which shows up in lspci):
Code: [Select]
# lspci |grep Ethernet
05:08.0 Ethernet controller: Intel Corporation 82801DB PRO/100 VM (LOM) Ethernet Controller (rev 81)
05:0a.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 30)

Then I started following the "Single to Double NIC" wiki instructions. In the first step, "Web Admin: Advanced menu > Network > Network Settings", I saw that LMCE saw 2 network cards, though it offered to config them as eth0 (configurable with either DHCP or static IP/netmask/gateway) and eth0:0 (just a static IP# config), which was strange, because eth0:0 is virtual, and I've got 2 physical cards. But Linux (ifconfig) does see the 2nd ethernet interface as eth0:0 . Following (by inference) the wiki instructions, I set the eth0:0 IP# to 192.168.1.10 (leaving the eth0 interface manually set to 192.168.0.10/255.255.255.0). When I submitted the change, the page did not return, though the eth0:0 IP# is changed and apache is still running. The Adminsite is gone, as the external interface IP# no longer seems to have a webserver listening.

Code: [Select]
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0B:CD:01:72:4C 
          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20b:cdff:fe01:724c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2033061 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10922155 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1591419024 (1.4 GiB)  TX bytes:2071456480 (1.9 GiB)

eth0:0    Link encap:Ethernet  HWaddr 00:0B:CD:01:72:4C 
          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:9936648 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9936648 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2823888630 (2.6 GiB)  TX bytes:2823888630 (2.6 GiB)

Code: [Select]
# ps aux |grep apache
root     20509  0.0  0.3   2880   756 pts/15   R+   08:38   0:00 grep apache
root     25556  0.0  2.7  23348  6728 ?        Ss   Dec17   0:00 /usr/sbin/apache2 -k start
www-data 25574  0.0  1.4  23348  3484 ?        S    Dec17   0:00 /usr/sbin/apache2 -k start
www-data 25575  0.0  1.4  23348  3480 ?        S    Dec17   0:00 /usr/sbin/apache2 -k start
www-data 25576  0.0  1.4  23348  3480 ?        S    Dec17   0:00 /usr/sbin/apache2 -k start
www-data 25577  0.0  1.4  23348  3480 ?        S    Dec17   0:00 /usr/sbin/apache2 -k start
www-data 25578  0.0  1.4  23348  3480 ?        S    Dec17   0:00 /usr/sbin/apache2 -k start

I expect that apache is now listening on the eth0:0 interface. I haven't tested that, because I don't want to believe that LMCE exposes the Adminsite to only its internal LAN segment, rather than to other devices on the external LAN segment with the hybrid. I hope someone can explain otherwise.

Code: [Select]
# cat /etc/network/interfaces
auto lo
        iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.0.10
        netmask 255.255.255.0
        gateway 192.168.0.1
auto eth0:0
iface eth0:0 inet static
        address 192.168.1.10
        netmask 255.255.255.0

Meanwhile, there are other weird symptoms: I'm still logged into a working ssh session started before I changed the eth0:0 IP#, but I can't initiate new ones to the old IP# (which should still be configured on eth0). Pinging that old IP# fails with 100% packet loss.

I'm not even sure where to change the eth0:0 IP# back to the old 192.168.0.10 IP#, to undo that last (catastrophic) change, with my ssh or console access. I guess I can just reinstall LMCE from scratch, but there should be a way to switch back & forth between single and double NIC setups. Any advice?

21
Developers / Language Bindings
« on: December 11, 2007, 10:12:31 pm »
In a discussion "LinuxMCE and Misterhouse" on the Users forum, tschak909 tricked me ;) into volunteering to help produce new language bindings for LMCE scripting in addition to existing Ruby support:

What is the current state of the APIs for making language bindings to LMCE? Where can I find a guide to making a new language binding (generally, not just for LMCE) that will work properly and be recognizable to developers who use them? Preferably a HowTo for binding Perl, which will be the first one I try. If the LMCE API is not in a condition to just add a new Perl language binding, who can help me upgrade it to be ready for that project?

22
Developers / DLNA Support?
« on: December 11, 2007, 10:01:39 pm »
LMCE supports lots of network Plug & Play. Does it support DLNA? Or even the actual UPNP standard, of which DLNA is a strict implementation?

DLNA support would mean that LMCE would itself become plug & play on networks with other DLNA equipment, whether DLNA clients or servers. LMCE installs could use various DLNA devices without sweating it. Is it already in there, or maybe just a little development away?

23
Users / LMCE vs Windows MCE Wiki Entry
« on: December 11, 2007, 08:57:32 pm »
I created a new article in the wiki, "Windows MCE vs LinuxMCE". It is very incomplete, and probably inaccurate, especially regarding the Windows features. Please update it with better and more complete info.

BTW, I reused the structure markup from a similar Wikipedia page, but the LMCE wiki doesn't seem to support the {wikitable} template or <ref> tags. It should - until then, the article I added looks terrible.

24
Compatible Products & Services / LMCE Deployer in NYC?
« on: December 10, 2007, 05:10:06 pm »
Anyone out there selling commercial services that will customize, install, deploy, train and support LMCE in homes onsite in NYC?

25
Compatible Products & Services / Ziotek 150-CD Carousel
« on: December 05, 2007, 04:37:59 am »
The "Ziotek Media Carousel Plus" manages 150 discs. They're also only $200 (even as little as $139), controlled by USB to select which disc to pop out. They don't have a player/recorder, but could they be combined with a single-disc player, with LMCE controlling both devices, for an automated solution? Is there some way to automate the ejected disc from the carousel to load into the player drive?

I know, the Sony XL-1B does it all for only $200 or so, but they're going to run out sometime. Could this carousel, or maybe one similar to it, ensure LMCE has automated jukebox features indefinitely?

26
Developers / Mining Paul's Brain
« on: December 02, 2007, 10:11:47 pm »
Paul recently posted "All Developers, please read", a very strong insight into the transition the LMCE project is making from Paul's solo forking effort, with a little help, into a real community project. But a lot of the knowledge of how the code works architecturally is still locked up inside Paul. Paul is very busy with the technical work, even while opening it to a team effort, and claims he's not the right person to write docs even with a lot of free time available. But he is available to answer questions, though he wants a system to keep him from being inundated. And we've got a "community liason" in danielk, suiting Paul's needs for someone to filter the rest of the project.

We still need a way to use that structure to get the community to share Paul's expertise, so we can help with the project ourselves (and help ourselves to it). We need to be able to formulate questions so Paul can turn around answers, especially questions of how to map features to the code that supports those features. Like "which code gets called when the 'rip all' button is pressed in the Orbiter GUI, that calls the scripts that do the ripping, DB updating, etc?"

A good protocol might be simply for people to discuss in this developers forum whatever problems we're working on, until they slam up against some undocumented code in that map we'd like to have. Then someone in that discussion can offer to ask that question of the "gurus". Once the thread agrees on the actual question to ask, someone can post that question in a sticky "Ask Paul" thread. danielk can subscribe to that thread, collect questions, answer those he can do without Paul's help, and then get Paul to answer. Either through danielk replying, or Paul can of course reply directly. The person getting the answer could dump the answer into the wiki, in a "How It Works" section of a given feature's page, to make the most of the help for everyone. That would be a good "community liason". People who want to help out with documentation can cruise that "Ask Paul" thread, looking for answers to put in the wiki, and to clean up the wiki.

That whole process is informal, and anyone can cut through it if they want and can. But it would make things go a lot faster for everyone. danielk, maybe Paul, can you work with that? Can we all work with that?

27
Developers / Serious FLAC Security Bug
« on: November 20, 2007, 03:33:09 am »
Quote
Multiple Vulnerabilities In .FLAC File Format and Various Media Applications
Release Date:
November 15, 2007

Date Reported:
September 28, 2007

Patch Development Time (In Days): 48      

Severity:
High (Remote Code Execution)

Vendor:
Multiple Vendors

Systems Affected:
Applications with FLAC Support

Overview:
eEye Digital Security has discovered 14 vulnerabilities in the processing of FLAC (Free-Lossless Audio Codec) files affecting various applications. Processing a malicious FLAC file within a vulnerable application could result in the execution of arbitrary code at the privileges of the application or the current user (depending on OS).

Technical Details:
The vulnerabilities in the .FLAC format are due to improperly handling metadata values from malformed files. The file format is available here: http://flac.sourceforge.net/format.html.

(Vulnerabilities 1-14)
LMCE generates its own FLAC files (eg by ripping CDs when FLAC is the specified archive format), so the risk to LMCE is minimal, unless users import FLACs generated by a malicious party. However, leaving a vulnerable executable in the system is still a known risk of unknown probability, which is an unnecessary risk.

This vulnerability report also raises the qustion of how LMCE handles the discovery of bugs like this, and how the development project responds to it. Kubuntu's APT system lets its dependency on Ubuntu automatically upgrade to security fix releases. Are we sure that all LMCE components are in that system? How do we respond to ones that are not?

28
Developers / Bluetooth Speakers?
« on: November 17, 2007, 04:21:49 pm »
Bluetooth speakers, with integrated DAC/amp/speakers, are starting to appear on the market. LMCE already has some BT integration, using a profile that lets some Symbian phones operate an Orbiter for remote control. If I want to use some BT speakers instead of, say, a Squeezebox for audio distribution, where would I start in the LMCE source code? Anyone have any experience coding to deliver audio to devices like BT speakers?

29
Users / Deleting a wiki page?
« on: November 15, 2007, 09:49:25 pm »
I edited the Cisco 7970 wiki entry, and discovered an identical page CISCO 7970 Orbiter. The redundant page should be deleted. Wikipedia has a deletion process that has a lot of discussion, then some privileged admin deletes a page when there's agreement. What's the process for deleting pages here in the LMCE wiki?

30
Users / SIP Cisco 7970?
« on: November 15, 2007, 06:50:44 am »
The Cisco 7970 support in LMCE (via the Asterisk subsystem) seems to use the 7970 in its default SCCP protocol version. But the 7970 can be upgraded to SIP protocol by upgrading its firmware (available for purchase from Cisco). And Asterisk's support for SIP is much more reliable and robust than its SCCP support. Does anyone have instructions for configuring the LMCE server as the TFTP server to perform the upgrade, and configuring the Asterisk subsystem to use it?

Pages: 1 [2] 3