67
int channel_open(char *name, int *bs)
68
int channel_open(const char *name, int *bs)
71
struct dahdi_params tp;
75
/* channo==0: The user passed a file name to be opened. */
76
dev = channo ? DEVICE : name;
78
fd = open(dev, O_RDWR, 0600);
85
/* If we got a channel number, get it from /dev/dahdi/channel: */
86
if(channo && ioctl(fd, DAHDI_SPECIFY, &channo) < 0) {
90
if(ioctl(fd, DAHDI_SET_BLOCKSIZE, bs) < 0) {
71
struct dahdi_params tp;
74
/* stat file, if character device, open it */
75
channo = strtoul(name, NULL, 10);
76
fd = stat(name, &filestat);
77
if (!fd && S_ISCHR(filestat.st_mode)) {
78
fd = open(name, O_RDWR, 0600);
83
/* try out the dahdi_specify interface */
84
} else if (channo > 0) {
85
fd = open(DEVICE, O_RDWR, 0600);
90
if (ioctl(fd, DAHDI_SPECIFY, &channo) < 0) {
91
perror("DAHDI_SPECIFY ioctl failed");
96
fprintf(stderr, "Specified channel is not a valid character "
97
"device or channel number");
101
if (ioctl(fd, DAHDI_SET_BLOCKSIZE, bs) < 0) {
91
102
perror("SET_BLOCKSIZE");