mirror of
				https://github.com/DigitalDevices/dddvb.git
				synced 2025-03-01 10:35:23 +00: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:
		
							
								
								
									
										14
									
								
								apps/cit.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								apps/cit.c
									
									
									
									
									
								
							| @@ -92,6 +92,10 @@ void *get_ts(void *a) | ||||
| 		return NULL; | ||||
| 	sprintf(fname, "/dev/dvb/adapter%u/ci%u", adapter, device); | ||||
| 	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); | ||||
| @@ -123,6 +127,10 @@ int send(void) | ||||
| 		return -1; | ||||
| 	sprintf(fname, "/dev/dvb/adapter%u/ci%u", adapter, device); | ||||
| 	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++) { | ||||
| @@ -146,7 +154,7 @@ int send(void) | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
| 	pthread_t th; | ||||
| 	 | ||||
|  | ||||
| 	while (1) { | ||||
|                 int option_index = 0; | ||||
| 		int c; | ||||
| @@ -179,13 +187,15 @@ int main(int argc, char **argv) | ||||
| 			break; | ||||
| 		case 'h': | ||||
| 		default: | ||||
| 			printf("cit -a<adapter> -d<device>\n"); | ||||
| 			exit(-1); | ||||
| 			break; | ||||
| 			 | ||||
| 		} | ||||
| 	} | ||||
| 	if (optind < argc) { | ||||
| 		printf("Warning: unused arguments\n"); | ||||
| 	} | ||||
| 	printf("adpter %d, device: %d\n", adapter, device); | ||||
| 	memset(ts+8, 180, 0x5a); | ||||
| 	pthread_create(&th, NULL, get_ts, NULL); | ||||
| 	usleep(10000); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user