1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

Improvements for cit

- Added error checking.
- Added help text.
- Added info.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
This commit is contained in:
Ralph Metzler 2017-07-26 02:35:40 +02:00
parent 24503d35ad
commit d4d0a9b84e

View File

@ -93,6 +93,10 @@ void *get_ts(void *a)
sprintf(fname, "/dev/dvb/adapter%u/ci%u", adapter, device);
printf("using %s for reading\n", fname);
fdi = open(fname, O_RDONLY);
if (fdi == -1) {
printf("Failed to open %s for read: %m\n", fname);
return NULL;
}
while (1) {
memset(buf, 0, 188*rnum);
@ -125,6 +129,10 @@ int send(void)
sprintf(fname, "/dev/dvb/adapter%u/ci%u", adapter, device);
printf("using %s for writing\n", fname);
fdo=open(fname, O_WRONLY);
if (fdo == -1) {
printf("Failed to open %s to write: %m\n", fname);
exit(2);
}
while (1) {
for (i=0; i<snum; i++) {
@ -180,6 +188,8 @@ int main(int argc, char **argv)
rnum = strtoul(optarg, NULL, 10);
break;
case 'h':
printf("cit -a<adapter> -d<device>\n");
exit(-1);
default:
break;
@ -188,6 +198,7 @@ int main(int argc, char **argv)
if (optind < argc) {
printf("Warning: unused arguments\n");
}
printf("adapter %d, device: %d\n", adapter, device);
memset(ts+8, 180, 0x5a);
pthread_create(&th, NULL, get_ts, NULL);
usleep(10000);