# CID stops Displaying



## SteelersFan (Sep 7, 2004)

I have been having a problem with CID info not displaying on my Zippered S2DTivos. It will work for a day or so after a reboot but then stops. Anyone else seeing this? I have tried making 3 different boxes the server but get the same results. I have Vonage and have tried adjusting the quality setting up and down with no effect.

Is there a way to set up a cron job (or other automatic method) to reset the modem without rebooting the box (I'm already rebooting twice a week and don't want to increase that frequency)?

All input welcome.

ETA: Here's the output of /var/log/ncidd.log/:

```
Started: 01/29/2007 11:28
Server: ncidd 0.65
Processed config file: /var/hack/etc/ncid/ncidd.conf
Configured to send 'cidlog' to clients.
Configured to send 'cidinfo' to clients.
Processed alias file: /var/hack/etc/ncid/ncidd.alias
Verbose level: 1
Modem initialized.
Modem set for CallerID.
Started: 02/01/2007 11:29
Server: ncidd 0.65
Processed config file: /var/hack/etc/ncid/ncidd.conf
Configured to send 'cidlog' to clients.
Configured to send 'cidinfo' to clients.
Processed alias file: /var/hack/etc/ncid/ncidd.alias
Verbose level: 1
Modem initialized.
Modem set for CallerID.
```


----------



## jlc (Jun 18, 2002)

SteelersFan said:


> I have been having a problem with CID info not displaying on my Zippered S2DTivos. It will work for a day or so after a reboot but then stops. Anyone else seeing this? I have tried making 3 different boxes the server but get the same results. I have Vonage and have tried adjusting the quality setting up and down with no effect.
> 
> Is there a way to set up a cron job (or other automatic method) to reset the modem without rebooting the box (I'm already rebooting twice a week and don't want to increase that frequency)?


Try version 0.67. The enhancement script will now install it. There were some fixes and hopefully it will help with your problem. Some people run cron jobs to restart NCID so you could do that. NCID does support VoIP without a modem, but all the support libraries and Perl modules are not on the TiVo yet, so you will have to wait to try that solution.


----------



## SteelersFan (Sep 7, 2004)

Thanks John. I installed .67 but unfortunately that didn't fix the problem. I ended up settting up a cron job to restart ncidd. Here's the line I am using:

```
30 */2 * * * cd /var/hack/sbin; ./ncidd
```
 I started out resetting it twice a day but noticed that the modem would crap out more frequently so I went to every 6 hours and now every 2 hours. One question: Is there any issue with resetting the modem so often?

Also, I see this every so often:

```
Started: 02/12/2007 12:30
Server: ncidd 0.67
Processed config file: /var/hack/etc/ncid/ncidd.conf
Configured to send 'cidlog' to clients.
Configured to send 'cidinfo' to clients.
Processed alias file: /var/hack/etc/ncid/ncidd.alias
Verbose level: 1
Modem initialized.
[B][U]Unable to set modem CallerID: /dev/ttyS1[/U][/B]
Terminated: 02/12/2007 12:30
```
but CID will work anyway. Any thoughts?


----------



## jlc (Jun 18, 2002)

SteelersFan said:


> Thanks John. I installed .67 but unfortunately that didn't fix the problem. I ended up settting up a cron job to restart ncidd. Here's the line I am using:
> 
> ```
> 30 */2 * * * cd /var/hack/sbin; ./ncidd
> ...


I am not sure what is happening. Could you check, after it happens, to see if ncidd is hung or dead. If dead, the log file should show terminated. Does it?

The terminated message you see every so often is probably generated by your starting a second instance of ncidd. Your cron job assumes that ncidd is dead so it tries start it. This can confuse the modem. What you really want to do is check that ncidd is running, and if not, restart it.

Here is a simple, untested, shell script to run as a cron job. You can run it as often as you like, but try 15 minute intervals first. It only starts ncidd if it is not running. You can call the script restart-ncidd

```
#!/bin/sh

ps auxw | grep ncidd | grep -v grep
[ $? != 0 ] && /var/hack/sbin/ncidd
```
You can also log the date and time to a file when it restarts ncidd. Then you would know how often it dies. Maybe even note that it dies whenever something runs, for instance, dialing home. Here is the modified script, again untested, to do that:

```
#!/bin/sh

ps auxw | grep ncidd | grep -v grep
[ $? != 0 ] && \
{
    /var/hack/sbin/ncidd
    (echo -n "ncidd restarted: "; date) > /tmp/restart.log
}
```


----------



## SteelersFan (Sep 7, 2004)

Thanks again John. I couldn't get your script to run but I don't think ncidd itself is stopping. I think it's more of an issue of the modem hanging or something else crapping out.

As a test, I rem'd out my cron job that blindly restarts ncidd. I then rebooted the box. I got an entry in the log file that it started normally and ncidd was running in the proccesses. After an hour or two, ncidd stopped displaying cid info on the server box, stopped passing info to any clients, and no cid info would be added to the cid.log upon receiving a call.

Is there a simple command for manually stopping ncidd other than "kill <pid>"?
I thought I would put this and a restart into cron to hopefully resolve my issue. Any other words of wisdom are, of course, welcome.


----------



## jlc (Jun 18, 2002)

SteelersFan said:


> Thanks again John. I couldn't get your script to run but I don't think ncidd itself is stopping. I think it's more of an issue of the modem hanging or something else crapping out.


Sorry about that. You could try to find the problem by tracing it: sh -x restart-ncidd


> As a test, I rem'd out my cron job that blindly restarts ncidd. I then rebooted the box. I got an entry in the log file that it started normally and ncidd was running in the proccesses. After an hour or two, ncidd stopped displaying cid info on the server box, stopped passing info to any clients, and no cid info would be added to the cid.log upon receiving a call.


If something took over the modem and did not create the lockfile ncidd expects, the modem would probably not be in CID mode anymode, and therefore it would not send CID information to ncidd. As an experiment, start NCID and verify it working, force the TiVo to call home, and when the call finishes, see if ncidd is still working. If it is not, try this:

```
touch /var/tmp/modemlock
sleep 1
rm /var/tmp/modemlock
```
Modemlock is the default TiVo lock file ncidd uses, and is set in ncidd.conf. When you create the lockfile, ncidd will ignore the modem. When you remove the lockfile, ncidd will reinitialize the modem and reset it for Caller ID. Try a call and see if it is working again. The ncidd.log file will tell you if ncidd noticed the lock file.
[QUOTE
Is there a simple command for manually stopping ncidd other than "kill <pid>"?
I thought I would put this and a restart into cron to hopefully resolve my issue. Any other words of wisdom are, of course, welcome.[/QUOTE]
Not on the TiVo, but if it has pkill, then "pkill ncidd" will terminate it. If the above lockfile steps work, you can put them in a cron job.


----------



## SteelersFan (Sep 7, 2004)

Here's what I get when I run sh -x restart-ncidd. I'm not sure what to make of the output:

```
Fam Rm-TiVo# sh -x restart-ncidd
+
: command not found
+ ps auxw
+ grep ncidd
+ grep -v grep
  290 root        552 S   ./ncidd
24258 root        984 S   sh -x restart-ncidd
24261 root        536 S   grep ncidd
+ '[' 0 '!=' 0 ']'
' '{
: command not found
+ /var/hack/sbin/ncidd
: No such file or directoryin/ncidd
restart-ncidd: line 7: syntax error near unexpected token `/var/log/cid-restart.
'og
restart-ncidd: line 7: `    (echo -n "ncidd restarted: "; date) /var/log/cid-res
'art.log
```
I have Vonage so unfortunately, calling out doesn't work for me so I ran the lockfile commands anyway and here's what the ncidd.log gives me:

```
TTY in use: releasing modem 02/19/2007 01:23
TTY free: using modem again 02/19/2007 01:23
Modem initialized.
Modem set for CallerID.
```
I made a call from my cell phone and cid worked immediately! Thanks! Can I put those lockfile commands in cron like this?

```
30 */2 * * * touch /var/tmp/modemlock; sleep 1; rm /var/tmp/modemlock
```
 Any other suggestions?


----------



## jlc (Jun 18, 2002)

SteelersFan said:


> Here's what I get when I run sh -x restart-ncidd. I'm not sure what to make of the output:
> 
> ```
> Fam Rm-TiVo# sh -x restart-ncidd
> ...


The output indicates that it has a <CR> at the end of each line. You need to run dos2unix to strip them out. It also indicates that I selected a wrong name for the script. It should be called restart-ncid, not restart-ncidd. I think this will fix all the errors.


> I have Vonage so unfortunately, calling out doesn't work for me so I ran the lockfile commands anyway


I assume your TiVo uses the Internet to call home for listings. I am still interested in knowing if the call effects it.


> I made a call from my cell phone and cid worked immediately! Thanks! Can I put those lockfile commands in cron like this?
> 
> ```
> 30 */2 * * * touch /var/tmp/modemlock; sleep 1; rm /var/tmp/modemlock
> ```


Yes.


> Any other suggestions?


It appears like some other program is using the modem. Maybe you can track it down. Two things to look for: a getty on the modem port, and some other program that uses the modem.


----------



## SteelersFan (Sep 7, 2004)

jlc said:


> The output indicates that it has a <CR> at the end of each line. You need to run dos2unix to strip them out. It also indicates that I selected a wrong name for the script. It should be called restart-ncid, not restart-ncidd. I think this will fix all the errors.


Ran dos2unix, renamed the script and inserted a ">" to fix the line 7 syntax error (you have it in your code in the above post but it's missing in the script that accompanies the package). 
From:

```
(echo -n "ncidd restarted: "; date) /tmp/restart.log
```
 To:

```
(echo -n "ncidd restarted: "; date) > /tmp/restart.log
```



jlc said:


> I assume your TiVo uses the Internet to call home for listings. I am still interested in knowing if the call effects it.


 Mine are S2DTivos, so they don't call home at all.



jlc said:


> It appears like some other program is using the modem. Maybe you can track it down. Two things to look for: a getty on the modem port, and some other program that uses the modem.


I can't tell if something else is using the modem; I don't think so though. I've attached the output of ps in case you would like to look to see if anything pops out at you.

I've set up two cron jobs as a work around to keep ncidd working. First I use the lockfile commands every 30 minutes:

```
# Reinitialize the modem every 30 minutes so ncidd will work properly
*/30 * * * * touch /ver/tmp/modemlock; sleep 1; rm /var/tmp/modemlock
```
Then I run the restart-ncid (renamed from restart-ncidd) every 30 minutes one minute later. This is useful as ncidd will occasionally quit, probably due to resetting the modem so often (I'm guessing). BTW, I figured out that if you don't rename the script it finds itself running and doesn't start ncidd.

```
# Restart ncidd only if it is not running
*/31 * * * * cd /var/hack/sbin; sh restart-ncid
```
ncidd has been working pretty well this week since I've made these changes. The modem/ncidd has only stopped working twice but with the restarts, it's only 30 minutes max before they're back up. Here are some log captures. ncidd.log:

```
TTY in use: releasing modem 02/22/2007 15:30
TTY free: using modem again 02/22/2007 15:30
No modem found: /dev/ttyS1
Terminated: 02/22/2007 15:30
Started: 02/22/2007 15:31
Server: ncidd 0.67
Processed config file: /var/hack/etc/ncid/ncidd.conf
Configured to send 'cidlog' to clients.
Configured to send 'cidinfo' to clients.
Processed alias file: /var/hack/etc/ncid/ncidd.alias
Verbose level: 1
Modem initialized.
Modem set for CallerID.
```
And cid-restart.log:

```
ncidd restarted: Thu Feb 22 15:31:06 UTC 2007
```
Thanks so much for your guidance. I really appreciate it!  :up:


----------



## jlc (Jun 18, 2002)

SteelersFan said:


> Ran dos2unix, renamed the script and inserted a ">" to fix the line 7 syntax error (you have it in your code in the above post but it's missing in the script that accompanies the package).


I picked up on the missing ">" and corrected my post, but I was not fast enough.



> I can't tell if something else is using the modem; I don't think so though. I've attached the output of ps in case you would like to look to see if anything pops out at you.


I noticed that you have tcphonehome running. Perhaps that is doing it?



> I've set up two cron jobs as a work around to keep ncidd working. First I use the lockfile commands every 30 minutes:


No need to run 2 cron jobs, just combine the two into one. Put the lockfile and sleep commands first in the script.

I noticed your log shows that sometimes it does not see the modem. Set sleep to 2 seconds, and see if that improves it.



> Thanks so much for your guidance. I really appreciate it!  :up:


Glad I was able to help somewhat.


----------



## SteelersFan (Sep 7, 2004)

jlc said:


> I noticed that you have tcphonehome running. Perhaps that is doing it?


I'm not even sure what that is, why it is running or where it is being started from. Any insight?


----------

