Mercurial > pt1
comparison recpt1/recpt1.c @ 89:d74bcf2d255d
do not give up if LNB ioctl failed
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 27 Jan 2010 15:12:50 +0900 |
parents | 59065b569eec |
children | 2b55985bbb4c |
comparison
equal
deleted
inserted
replaced
88:59065b569eec | 89:d74bcf2d255d |
---|---|
653 } | 653 } |
654 | 654 |
655 /* power on LNB */ | 655 /* power on LNB */ |
656 if(tdata->table->type == CHTYPE_SATELLITE) { | 656 if(tdata->table->type == CHTYPE_SATELLITE) { |
657 if(ioctl(tdata->tfd, LNB_ENABLE, tdata->lnb) < 0) { | 657 if(ioctl(tdata->tfd, LNB_ENABLE, tdata->lnb) < 0) { |
658 close(tdata->tfd); | |
659 fprintf(stderr, "Power on LNB failed: %s\n", device); | 658 fprintf(stderr, "Power on LNB failed: %s\n", device); |
660 return 1; | |
661 } | 659 } |
662 } | 660 } |
663 | 661 |
664 /* tune to specified channel */ | 662 /* tune to specified channel */ |
665 if(ioctl(tdata->tfd, SET_CHANNEL, &freq) < 0) { | 663 if(ioctl(tdata->tfd, SET_CHANNEL, &freq) < 0) { |
686 tdata->tfd = open(tuner[lp], O_RDONLY); | 684 tdata->tfd = open(tuner[lp], O_RDONLY); |
687 if(tdata->tfd >= 0) { | 685 if(tdata->tfd >= 0) { |
688 /* power on LNB */ | 686 /* power on LNB */ |
689 if(tdata->table->type == CHTYPE_SATELLITE) { | 687 if(tdata->table->type == CHTYPE_SATELLITE) { |
690 if(ioctl(tdata->tfd, LNB_ENABLE, tdata->lnb) < 0) { | 688 if(ioctl(tdata->tfd, LNB_ENABLE, tdata->lnb) < 0) { |
691 close(tdata->tfd); | 689 fprintf(stderr, "Warning: Power on LNB failed: %s\n", tuner[lp]); |
692 tdata->tfd = -1; | |
693 continue; | |
694 } | 690 } |
695 } | 691 } |
696 | 692 |
697 /* tune to specified channel */ | 693 /* tune to specified channel */ |
698 if(ioctl(tdata->tfd, SET_CHANNEL, &freq) < 0) { | 694 if(ioctl(tdata->tfd, SET_CHANNEL, &freq) < 0) { |
775 } | 771 } |
776 | 772 |
777 int | 773 int |
778 close_tuner(thread_data *tdata) | 774 close_tuner(thread_data *tdata) |
779 { | 775 { |
776 int rv = 0; | |
777 | |
780 if(tdata->table->type == CHTYPE_SATELLITE) { | 778 if(tdata->table->type == CHTYPE_SATELLITE) { |
781 if(ioctl(tdata->tfd, LNB_DISABLE, 0) < 0) { | 779 if(ioctl(tdata->tfd, LNB_DISABLE, 0) < 0) { |
782 return 1; | 780 rv = 1; |
783 } | 781 } |
784 } | 782 } |
785 close(tdata->tfd); | 783 close(tdata->tfd); |
786 | 784 |
787 return 0; | 785 return rv; |
788 } | 786 } |
789 | 787 |
790 int | 788 int |
791 main(int argc, char **argv) | 789 main(int argc, char **argv) |
792 { | 790 { |