Author Topic: Why my device driver cannot register with DCERouter (works if run from cmd.line)  (Read 9557 times)

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Hi,

I wrote device driver that connects to DCERouter via 2 tcp ports (one for receiving command and other one for sending events to DCErouter). I've created template for that device driver and added name of binary file that actually runs the driver. I've added driver to Interface category - it has several child devices....

I have problems when I want the device driver to be started by LMCE. From log I write in device driver I can see that app was started, but the problem is that on web page it says that it hasn't registered with DCErouter, so I suppose that all messages/events it sends are ignored by DCERouter. The funny thing is that if I kill that LMCE started app and start it from command line it registers immediately...

I see nothing suspicious in DCERouter's logs. I have this :
/var/log/pluto/290_Cybrotech_Integra_BM.log :
Quote
========== NEW LOG SECTION ==========
1   02/12/08 09:21:52   290 (spawning-device)   Starting... 1
1   02/12/08 09:21:52   290 (spawning-device)   Found /usr/pluto/bin/Cybrotech_Integra_BM

/var/log/pluto/LaunchManager.log (it reports timeout waiting for device registration ???):
Quote
05   02/12/08 9:21:52.370      Starting device 290 Cybrotech Automation <0xb68388e0>
05   02/12/08 9:21:52.370      Starting device 290 Cybrotech Automation: /usr/bin/screen -d -m -S Cybrotech_Automation-290 /usr/pluto/bin/Spawn_Device.sh 290 localhost Cybrotech_Integra_BM <0xb68388e0>
05   02/12/08 9:22:05.631      Timeout waiting for device registration <0xb68388e0>

Any hint, what might be going wrong ?

Thanks in advance,

regards,

Bulek.
Thanks in advance,

regards,

Bulek.

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Bulek,

I'm shooting in the dark here, but I'll offer my 2 cents..
Could it be trying to initialize some data that requires DCE communication?

I'm assuming your coding in C++.. try creating a 'dummy' device with dcegen, and see if it registers.
If it does, maybe that might show you what you are or are not doing right..

HTH,

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Bulek,

Looking at the line from your LaunchManager log;  /usr/bin/screen -d -m -S Cybrotech_Automation-290 /usr/pluto/bin/Spawn_Device.sh 290 localhost Cybrotech_Integra_BM

Is the localhost reference in there meant to the address of your core? Is this running on your Core? What do other device startups look like? The Same?

From memory I think that Spawn_Device waits for particular return codes and may give this error if it is not getting them. Is your startup code inside the device very complex, have you compared it to a device that does work?

All pretty vague comments - but hope it can help a bit

regards
Darren

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Hi,

thanks for hints. I'm still in that problem, but will probably rather start again working on it on 710b3 release. Something is messed up, cause it works from command line and stays registered - it only doesn't work it started automatically. I've also added some logging code and it seems it registers ok (it receives OKs from Router as acknowledge for sent registration messages).

I have not enough knowledge to see of one of Spawn scripts is messing around, but I got told by develoepers that only DCERouter handles that Registered tick that is shown on web-admin...

Will see and get back with more info when I'll have it,

regards,

Bulek.
Thanks in advance,

regards,

Bulek.

kir

  • Guru
  • ****
  • Posts: 183
    • View Profile
Try to enable verbose logging in /etc/pluto.conf : LogLevels=1,2,3,4,5,6,7,8,9,10 and stop LinuxMCE from Launch Manager, then restart Launch Manager and start LinuxMCE - and check the /var/log/pluto/LaunchManager.log for the possible mentions of your device, maybe it is the binary that is not found by LaunchManager, or something similar.

PeteK

  • Guru
  • ****
  • Posts: 408
    • View Profile
BuleK--

I was having a similar issue with my Insteon device not being able to start up automatically, but working correctly at the command line.

Kirill, one of the devlopers spent a little time working on it and found this information.  I'll check to see if he was able to find a solution.

Here's what he wrote:

1) the device is not starting with code 126 (typically this means it is not executable - reported by shell). weird thing, maybe some issue in scripts

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Hi,

my case is even funnier. My script gets started and reports everything ok (it also receives OKs from DCERouter when registering), but it says in Launch manager that timeout has gone by for device registering process, so it probably shuts down tcp connections after 15 mins. My device continues to work, but it works only on one way - sending events to DCErouter, but not receiving any...

Regards,

Bulek.
Thanks in advance,

regards,

Bulek.

kir

  • Guru
  • ****
  • Posts: 183
    • View Profile
my case is even funnier. My script gets started and reports everything ok (it also receives OKs from DCERouter when registering), but it says in Launch manager that timeout has gone by for device registering process, so it probably shuts down tcp connections after 15 mins. My device continues to work, but it works only on one way - sending events to DCErouter, but not receiving any...

The timeout of waiting for media device registration is 10 seconds - does your device take more time to startup and register with the DCERouter? Additionally: if you will start device manually from the command line - does the webUI contain line "Registered: Yes" in the properties of this device, when it is fully started up (this line reflects the status of device registration with the router).

kir

  • Guru
  • ****
  • Posts: 183
    • View Profile
I also think that it is a good idea to do DCEGen-eration of the dummy binary and see if it works (properly registers). Try also tailing the full DCERouter.log to see if there are any error messages related to your device.

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
my case is even funnier. My script gets started and reports everything ok (it also receives OKs from DCERouter when registering), but it says in Launch manager that timeout has gone by for device registering process, so it probably shuts down tcp connections after 15 mins. My device continues to work, but it works only on one way - sending events to DCErouter, but not receiving any...

The timeout of waiting for media device registration is 10 seconds - does your device take more time to startup and register with the DCERouter? Additionally: if you will start device manually from the command line - does the webUI contain line "Registered: Yes" in the properties of this device, when it is fully started up (this line reflects the status of device registration with the router).
Hi,

thanks for info. It goes somehow like this :
- when auto started it seems that socket is removed from DCERouter (I wish I could know the reason) and device says "Registered: No" on web admin. But outgoing socket remains and device sends events to LMCE for days ...
- if I start it from command line it registers ok and also is shown as Registered: Yes on web admin. This one bugs me. what is different that it doesn't autostart, but runs from command line ever after...
Two most suspicious sinppets from DCERouter's log. What do first two lines mean ?

Quote
      02/19/08 1:00:34.292            Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Incoming_Conn Socket 146 192.168.0.1 dev 290 <0x7eccab90>
05      02/19/08 1:00:34.292            Router::RemoveAndDeleteSocket 0x81eca20 290 <0x7eccab90>
05       02/19/08 1:02:52.512            The target device 384 (routed to 290) has not registered. <0xb6c5ab90>
dce

Thanks in advance,

regards,

bulek.
Thanks in advance,

regards,

Bulek.

kir

  • Guru
  • ****
  • Posts: 183
    • View Profile
Yes, it seems the socket is dropped but I don't see any reason for it. Can you re-run the DCEGen in the new folder to generate the initial binary for your device template, then build it and see if the same happens with it (i.e. socket is dropped)? This would narrow the list of possible reasons (maybe it is something with your code).

Also, for those timestamps: do you see any related errors/messages in the "Cybrotech Automation" log itself?

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
kir,
Glad to see you getting more involved in here! :)
I'm sure you have a wealth of information, just aching to be tapped... ;)

« Last Edit: February 19, 2008, 08:09:32 pm by ddamron »
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Hi,

I'd like to ask a small trick for Linux guys: how to search through all logs for particular string (in my case that would be name of device, or date when something happened) ?

Thanks in advance,

regards,

Bulek.
Thanks in advance,

regards,

Bulek.

kir

  • Guru
  • ****
  • Posts: 183
    • View Profile
I'd like to ask a small trick for Linux guys: how to search through all logs for particular string (in my case that would be name of device, or date when something happened) ?

To search for certain string in file:

$ grep string filename

in all pluto logs

$ grep string /var/log/pluto/*

case insensitive search: add "-i" switch after the grep:

$ grep -i string file