1
/***************************************************************************
2
checkcom.cpp - description
4
begin : Fri Apr 21 2000
5
copyright : (C) 2000 by Volker Schroer
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* based on the work of Moe Wheatly, AE4JY *
16
***************************************************************************/
22
bool checkcom(const char* s)
27
struct serial_struct serinfo;
30
fd=open(s,O_RDWR|O_NONBLOCK);
36
serinfo.reserved_char[0] = 0;
37
if (ioctl(fd, TIOCGSERIAL, &serinfo) < 0)
43
if ( serinfo.type == 5 || serinfo.type ==0 )
49
/*int getInputVolume()
51
return getVolume( MIXER_READ(SOUND_MIXER_MIC));
56
return getVolume(SOUND_MIXER_VOLUME);
59
int getVolume(int Device)
64
fd=open("/dev/mixer",O_RDWR);
69
if (ioctl(fd,MIXER_READ(Device),&volume) == -1)
76
void setVolume(int Device,int volume)
81
fd=open("/dev/mixer",O_RDWR);
87
// vol = vol | ( volume & 0x7f);
89
ioctl(fd,MIXER_WRITE(Device),&volume);
94
void setOutputVolume(int volume)
96
setVolume(MIXER_WRITE(SOUND_MIXER_VOLUME),volume);
99
void setInputVolume(int volume)
101
setVolume(MIXER_WRITE(SOUND_MIXER_MIC),volume);
104
void setInputSource(int Device)
108
mixer_channel= (1 << Device);
110
fd_mixer=open("/dev/mixer",O_RDWR); //Open Mixer
112
ioctl(fd_mixer,MIXER_WRITE(SOUND_MIXER_RECSRC),&mixer_channel);