Merge remote-tracking branch 'alanc/master'

This commit is contained in:
Keith Packard 2011-09-21 14:30:19 -07:00
commit 98f4940093
12 changed files with 621 additions and 543 deletions

View File

@ -3442,8 +3442,7 @@ CloseDownClient(ClientPtr client)
* now. If it hasn't gotten to Running, nClients has *not*
* been incremented, so *don't* decrement it.
*/
if (client->clientState != ClientStateInitial &&
client->clientState != ClientStateAuthenticating )
if (client->clientState != ClientStateInitial)
{
--nClients;
}
@ -3705,19 +3704,8 @@ ProcEstablishConnection(ClientPtr client)
auth_proto,
(unsigned short)prefix->nbytesAuthString,
auth_string);
/*
* If Kerberos is being used for this client, the clientState
* will be set to ClientStateAuthenticating at this point.
* More messages need to be exchanged among the X server, Kerberos
* server, and client to figure out if everyone is authorized.
* So we don't want to send the connection setup info yet, since
* the auth step isn't really done.
*/
if (client->clientState == ClientStateCheckingSecurity)
client->clientState = ClientStateCheckedSecurity;
else if (client->clientState != ClientStateAuthenticating)
return(SendConnSetup(client, reason));
return Success;
}
void

View File

@ -103,6 +103,8 @@ xf86InfoRec xf86Info = {
.vtPendingNum = -1,
#endif
.dontVTSwitch = FALSE,
.autoVTSwitch = TRUE,
.ShareVTs = FALSE,
.dontZap = FALSE,
.dontZoom = FALSE,
.notrapSignals = FALSE,

View File

@ -1352,6 +1352,16 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86xkbdirFlag = TRUE;
return 0;
}
if (!strcmp(argv[i], "-novtswitch"))
{
xf86Info.autoVTSwitch = FALSE;
return 1;
}
if (!strcmp(argv[i], "-sharevts"))
{
xf86Info.ShareVTs = TRUE;
return 1;
}
/* OS-specific processing */
return xf86ProcessArgument(argc, argv, i);
@ -1408,6 +1418,8 @@ ddxUseMsg(void)
ErrorF("-version show the server version\n");
ErrorF("-showDefaultModulePath show the server default module path\n");
ErrorF("-showDefaultLibPath show the server default library path\n");
ErrorF("-novtswitch don't automatically switch VT at reset & exit\n");
ErrorF("-sharevts share VTs with another X server\n");
/* OS-specific usage */
xf86UseMsg();
ErrorF("\n");

View File

@ -66,6 +66,8 @@ typedef struct {
int vtPendingNum;
#endif
Bool dontVTSwitch;
Bool autoVTSwitch;
Bool ShareVTs;
Bool dontZap;
Bool dontZoom;
Bool notrapSignals; /* don't exit cleanly - die at fault */

View File

@ -1,4 +1,3 @@
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@ -41,13 +40,15 @@ const FI1236_parameters tuner_parms[NUM_TUNERS] =
};
FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr)
FI1236Ptr
Detect_FI1236 (I2CBusPtr b, I2CSlaveAddr addr)
{
FI1236Ptr f;
I2CByte a;
f = calloc(1,sizeof(FI1236Rec));
if(f == NULL) return NULL;
if (f == NULL)
return NULL;
f->d.DevName = strdup("FI12xx Tuner");
f->d.SlaveAddr = addr;
f->d.pI2CBus = b;
@ -61,45 +62,49 @@ FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr)
f->last_afc_hint=TUNER_OFF;
f->video_if=45.7812;
if(!I2C_WriteRead(&(f->d), NULL, 0, &a, 1))
{
if (!I2C_WriteRead(&(f->d), NULL, 0, &a, 1)) {
free(f);
return NULL;
}
FI1236_set_tuner_type(f, TUNER_TYPE_FI1236);
if(!I2CDevInit(&(f->d)))
{
if (!I2CDevInit(&(f->d))) {
free(f);
return NULL;
}
return f;
}
static void MT2032_dump_parameters(FI1236Ptr f, MT2032_parameters *m)
static void
MT2032_dump_parameters (FI1236Ptr f, MT2032_parameters *m)
{
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: input f_rf=%g f_if1=%g f_if2=%g f_ref=%g f_ifbw=%g f_step=%g\n",
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: input f_rf=%g f_if1=%g f_if2=%g f_ref=%g f_ifbw=%g f_step=%g\n",
m->f_rf, m->f_if1, m->f_if2, m->f_ref, m->f_ifbw, m->f_step);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: computed f_lo1=%g f_lo2=%g LO1I=%d LO2I=%d SEL=%d STEP=%d NUM=%d\n",
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: computed f_lo1=%g f_lo2=%g LO1I=%d LO2I=%d SEL=%d STEP=%d NUM=%d\n",
m->f_lo1, m->f_lo2, m->LO1I, m->LO2I, m->SEL, m->STEP, m->NUM);
}
static void MT2032_getid(FI1236Ptr f)
static void
MT2032_getid (FI1236Ptr f)
{
CARD8 out[4];
CARD8 in;
in = 0x11;
I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 4);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: Company code 0x%02x%02x, part code 0x%02x, revision code 0x%02x\n",
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: Company code 0x%02x%02x, part code 0x%02x, revision code 0x%02x\n",
out[0], out[1], out[2], out[3]);
}
/* might be buggy */
#if 0
static void MT2032_shutdown(FI1236Ptr f)
static void
MT2032_shutdown (FI1236Ptr f)
{
CARD8 data[10];
@ -128,7 +133,8 @@ usleep(15000);
static void MT2032_dump_status (FI1236Ptr f);
static void MT2032_init(FI1236Ptr f)
static void
MT2032_init (FI1236Ptr f)
{
CARD8 data[10];
CARD8 value;
@ -161,20 +167,24 @@ while(1) {
data[0] = 0x0e; /* register number 7, status */
value = 0xFF;
if (!I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1))
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to read XOK\n");
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: XOK=%d\n", value & 0x01);
if(value & 1) break;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: failed to read XOK\n");
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: XOK=%d\n", value & 0x01);
if (value & 1)
break;
data[0] = 0x07;
if (!I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1))
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to read XOGC\n");
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: failed to read XOGC\n");
xogc=value & 0x7;
if(xogc==4){
if (xogc == 4)
break; /* XOGC has reached 4.. stop */
}
xogc--;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: try XOGC=%d\n", xogc);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: try XOGC=%d\n", xogc);
usleep(15000);
data[0] = 0x07; /* register number 7, control byte 2 */
data[1] = 0x08 | xogc;
@ -186,7 +196,8 @@ usleep(15000); /* wait 50 milliseconds */
MT2032_dump_status(f);
}
static int MT2032_no_spur_in_band(MT2032_parameters *m)
static int
MT2032_no_spur_in_band (MT2032_parameters *m)
{
int n_max, n1, n2;
double f_test;
@ -198,23 +209,32 @@ while(1){
while (1) {
n2--;
f_test = f_test - m->f_lo2;
xf86DrvMsg(0, X_INFO, "testing f_test=%g n1=%d n2=%d f_lo1=%g f_lo2=%g f_if2=%g\n", f_test, n1, n2, m->f_lo1, m->f_lo2, m->f_if2);
xf86DrvMsg(0, X_INFO, "d_f=%g f_ifbw=%g\n",fabs(fabs(f_test)-m->f_if2), m->f_ifbw);
if((fabs(fabs(f_test)-m->f_if2)*2.0)<=m->f_ifbw)return 0;
if(n2<=-n_max)break;
xf86DrvMsg(0, X_INFO,
"testing f_test=%g n1=%d n2=%d f_lo1=%g f_lo2=%g f_if2=%g\n",
f_test, n1, n2, m->f_lo1, m->f_lo2, m->f_if2);
xf86DrvMsg(0, X_INFO, "d_f=%g f_ifbw=%g\n",
fabs(fabs(f_test) - m->f_if2), m->f_ifbw);
if ((fabs(fabs(f_test) - m->f_if2) * 2.0) <= m->f_ifbw)
return 0;
if (n2 <= -n_max)
break;
/* this line in the manual is bogus. I say it is faster
and more correct to go over all harmonics.. */
#if 0
if(f_test<(m->f_lo2-m->f_if2-m->f_ifbw))break;
if (f_test < (m->f_lo2 - m->f_if2 - m->f_ifbw))
break;
#endif
}
n1++;
if(n1>=n_max)return 1;
if (n1 >= n_max)
return 1;
}
}
static void MT2032_calculate_register_settings(MT2032_parameters *m, double f_rf, double f_if1, double f_if2, double f_ref, double f_ifbw, double f_step)
static void
MT2032_calculate_register_settings (MT2032_parameters *m, double f_rf,
double f_if1, double f_if2, double f_ref, double f_ifbw, double f_step)
{
int n;
m->f_rf = f_rf;
@ -233,12 +253,14 @@ m->f_lo2=m->f_lo1-f_rf-f_if2;
/* check for spurs */
n = 1;
while (n < 3) {
if(MT2032_no_spur_in_band(m))break;
if(m->f_lo1<(f_rf+f_if1)){
if (MT2032_no_spur_in_band(m))
break;
if (m->f_lo1 < (f_rf + f_if1))
m->LO1I += n;
} else {
else
m->LO1I -= n;
}
m->f_lo1 = m->LO1I * f_ref;
m->f_lo2 = m->f_lo1 - f_rf - f_if2;
n++;
@ -247,13 +269,14 @@ while(n<3){
/* select VCO */
/* m->f_lo1>1100.0 */
if(m->f_lo1<1370.0)m->SEL=4;
else
if(m->f_lo1<1530.0)m->SEL=3;
else
if(m->f_lo1<1720.0)m->SEL=2;
else
if(m->f_lo1<1890.0)m->SEL=1;
if (m->f_lo1 < 1370.0)
m->SEL = 4;
else if (m->f_lo1 < 1530.0)
m->SEL = 3;
else if (m->f_lo1 < 1720.0)
m->SEL = 2;
else if (m->f_lo1 < 1890.0)
m->SEL = 1;
else /* m->f_lo1 < 1958.0 */
m->SEL = 0;
@ -264,7 +287,8 @@ m->NUM=floor(3780.0*(m->f_lo2/f_ref-m->LO2I));
m->NUM = m->STEP * lrint((1.0 * m->NUM) / (1.0 * m->STEP));
}
static int MT2032_wait_for_lock(FI1236Ptr f)
static int
MT2032_wait_for_lock (FI1236Ptr f)
{
int n;
CARD8 data[10];
@ -274,20 +298,26 @@ n=12;
while(1) {
data[0] = 0x0e; /* register number 7, status */
I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
/* xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: LO1LK=%d LO2LK=%d\n", (value & 0x04)>>2, (value & 0x02)>>1); */
if((value & 6)==6) break;
/* xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: LO1LK=%d LO2LK=%d\n",
(value & 0x04)>>2, (value & 0x02)>>1); */
if ((value & 6)==6)
break;
usleep (1500);
n--;
if(n<0)break;
if (n < 0)
break;
}
if (n < 0) {
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to set frequency\n");
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: failed to set frequency\n");
return 0;
}
return 1;
}
static void MT2032_implement_settings(FI1236Ptr f, MT2032_parameters *m)
static void
MT2032_implement_settings (FI1236Ptr f, MT2032_parameters *m)
{
CARD8 data[10];
CARD8 value;
@ -300,13 +330,16 @@ I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
data[0] = 0x05; /* start with register 0x05 */
data[1] = ((m->LO2I & 0x7) << 5) | ((m->LO2I >> 3) - 1);
if(m->f_rf<400.0)data[2]=0xe4;
else data[2]=0xf4;
if (m->f_rf < 400.0)
data[2] = 0xe4;
else
data[2] = 0xf4;
I2C_WriteRead(&(f->d), (I2CByte *)data, 3, NULL, 0);
data[0] = 0x07; /* register number 7, control byte 2 */
I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: using XOGC=%d\n", (value & 0x07));
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: using XOGC=%d\n", (value & 0x07));
data[1] = 8 | (value & 0x7);
I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
@ -318,7 +351,8 @@ I2C_WriteRead(&(f->d), (I2CByte *)data, 3, NULL, 0);
MT2032_wait_for_lock(f);
}
static void MT2032_optimize_VCO(FI1236Ptr f, MT2032_parameters *m)
static void
MT2032_optimize_VCO (FI1236Ptr f, MT2032_parameters *m)
{
CARD8 data[10];
CARD8 value;
@ -327,13 +361,17 @@ CARD8 TAD1;
data[0] = 0x0f; /* register number 7, status */
I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
TAD1=value & 0x07;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: TAD1=%d SEL=%d\n", TAD1, m->SEL);
if(TAD1 < 2)return;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: TAD1=%d SEL=%d\n", TAD1, m->SEL);
if (TAD1 < 2)
return;
if (TAD1 == 2) {
if(m->SEL==0)return;
if (m->SEL == 0)
return;
m->SEL--;
} else {
if(m->SEL>=4)return;
if (m->SEL >= 4)
return;
m->SEL++;
}
data[0] = 0x01; /* start with register 1 */
@ -342,13 +380,13 @@ I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
}
static int FI1236_get_afc_hint(FI1236Ptr f)
static int
FI1236_get_afc_hint (FI1236Ptr f)
{
CARD8 out;
CARD8 AFC;
if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W))
{
if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) {
TDA9885Ptr t = (TDA9885Ptr)f->afc_source;
if (t == NULL)
return TUNER_OFF;
@ -357,26 +395,34 @@ static int FI1236_get_afc_hint(FI1236Ptr f)
tda9885_dumpstatus(t);
AFC = t->afc_status & 0x0f;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: FI1236_get_afc_hint: %i\n", AFC);
if (AFC == 0) return TUNER_TUNED;
else if (AFC <= 0x07)return TUNER_JUST_BELOW;
else if (AFC < 0x0f )return TUNER_JUST_ABOVE;
else if (AFC == 0x0f)return TUNER_TUNED;
}
else
{
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"AFC: FI1236_get_afc_hint: %i\n", AFC);
if (AFC == 0)
return TUNER_TUNED;
else if (AFC <= 0x07)
return TUNER_JUST_BELOW;
else if (AFC < 0x0f)
return TUNER_JUST_ABOVE;
else if (AFC == 0x0f)
return TUNER_TUNED;
} else {
I2C_WriteRead(&(f->d), NULL, 0, &out, 1);
AFC = out & 0x7;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: FI1236_get_afc_hint: %i\n", AFC);
if(AFC==2)return TUNER_TUNED;
if(AFC==3)return TUNER_JUST_BELOW;
if(AFC==1)return TUNER_JUST_ABOVE;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"AFC: FI1236_get_afc_hint: %i\n", AFC);
if (AFC == 2)
return TUNER_TUNED;
if (AFC == 3)
return TUNER_JUST_BELOW;
if (AFC == 1)
return TUNER_JUST_ABOVE;
return TUNER_OFF;
}
return TUNER_OFF;
}
static int MT2032_get_afc_hint(FI1236Ptr f)
static int
MT2032_get_afc_hint (FI1236Ptr f)
{
CARD8 in;
CARD8 out[2];
@ -385,22 +431,29 @@ in=0x0e;
I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 2);
AFC = (out[0] >> 4) & 0x7;
#if 0
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC=%d TAD1=%d TAD2=%d\n", AFC, out[1] & 0x7, (out[1]>>4)& 0x07);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC=%d TAD1=%d TAD2=%d\n",
AFC, out[1] & 0x7, (out[1]>>4)& 0x07);
#endif
if(AFC==2)return TUNER_TUNED;
if(AFC==3)return TUNER_JUST_BELOW;
if(AFC==1)return TUNER_JUST_ABOVE;
if (AFC == 2)
return TUNER_TUNED;
if (AFC == 3)
return TUNER_JUST_BELOW;
if (AFC == 1)
return TUNER_JUST_ABOVE;
return TUNER_OFF;
}
/* this function is for external use only */
int TUNER_get_afc_hint(FI1236Ptr f)
int
TUNER_get_afc_hint (FI1236Ptr f)
{
if(f->afc_timer_installed)return TUNER_STILL_TUNING;
if (f->afc_timer_installed)
return TUNER_STILL_TUNING;
return f->last_afc_hint;
}
static void MT2032_dump_status(FI1236Ptr f)
static void
MT2032_dump_status (FI1236Ptr f)
{
CARD8 in;
CARD8 out[2];
@ -421,10 +474,14 @@ AFC=(out[0]>>4) & 0x7;
TAD1 = (out[1] & 0x7);
TAD2 = (out[1] >> 4) & 0x7;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: status: XOK=%d LO1LK=%d LO2LK=%d LDONrb=%d AFC=%d TAD1=%d TAD2=%d\n",
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: status: XOK=%d LO1LK=%d LO2LK=%d LDONrb=%d AFC=%d TAD1=%d TAD2=%d\n",
XOK, LO1LK, LO2LK, LDONrb, AFC, TAD1, TAD2);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: status: OSCILLATOR:%s PLL1:%s PLL2:%s\n",
XOK ? "ok":"off", LO1LK ? "locked" : "off" , LO2LK ? "locked" : "off");
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: status: OSCILLATOR:%s PLL1:%s PLL2:%s\n",
XOK ? "ok" : "off",
LO1LK ? "locked" : "off",
LO2LK ? "locked" : "off");
}
@ -433,6 +490,7 @@ static void MT2032_tune(FI1236Ptr f, double freq, double step)
MT2032_parameters m;
CARD8 data[10];
int i;
/* NTSC IF is 44mhz.. but 733/16=45.8125 and all TDAXXXX docs mention
45.75, 39, 58.75 and 30. */
#if 0
@ -458,14 +516,18 @@ for(i=0;i<3;i++){
data[1] = 0x08 | f->xogc;
I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
}
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to set frequency\n");
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: failed to set frequency\n");
}
void FI1236_set_tuner_type(FI1236Ptr f, int type)
void
FI1236_set_tuner_type (FI1236Ptr f, int type)
{
f->type = type;
if(type>=NUM_TUNERS)type = NUM_TUNERS-1;
if(type<0)type = 0;
if (type >= NUM_TUNERS)
type = NUM_TUNERS-1;
if (type < 0)
type = 0;
memcpy(&(f->parm), &(tuner_parms[type]), sizeof(FI1236_parameters));
f->original_frequency = f->parm.min_freq;
f->afc_delta = 0;
@ -476,9 +538,12 @@ if(type==TUNER_TYPE_MT2032){
}
static CARD32 AFC_TimerCallback(OsTimerPtr timer, CARD32 time, pointer data){
static CARD32
AFC_TimerCallback(OsTimerPtr timer, CARD32 time, pointer data)
{
FI1236Ptr f = (FI1236Ptr)data;
if(FI1236_AFC(f))return 150;
if (FI1236_AFC(f))
return 150;
else {
f->afc_timer_installed = FALSE;
f->afc_count = 0;
@ -486,7 +551,8 @@ if(FI1236_AFC(f))return 150;
}
}
void FI1236_tune(FI1236Ptr f, CARD32 frequency)
void
FI1236_tune(FI1236Ptr f, CARD32 frequency)
{
CARD16 divider;
CARD8 data;
@ -500,35 +566,30 @@ void FI1236_tune(FI1236Ptr f, CARD32 frequency)
f->tuner_data.control = f->parm.control;
if (frequency < f->parm.threshold1)
{
f->tuner_data.band = f->parm.band_low;
}
else if (frequency < f->parm.threshold2)
{
f->tuner_data.band = f->parm.band_mid;
}
else
{
f->tuner_data.band = f->parm.band_high;
}
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Setting tuner band to %d\n", f->tuner_data.band);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"Setting tuner band to %d\n", f->tuner_data.band);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Setting tuner frequency to %d\n", (int)frequency);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"Setting tuner frequency to %d\n", (int)frequency);
if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W))
{
if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) {
f->tuner_data.aux = 0x20;
I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 5, NULL, 0);
I2C_WriteRead(&(f->d), NULL, 0, &data, 1);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Tuner status %x\n", data);
}
else
I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 4, NULL, 0);
}
void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency)
void
TUNER_set_frequency(FI1236Ptr f, CARD32 frequency)
{
if (frequency < f->parm.min_freq) frequency = f->parm.min_freq;
if (frequency > f->parm.max_freq) frequency = f->parm.max_freq;
@ -537,15 +598,11 @@ void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency)
f->original_frequency=frequency;
if (f->type == TUNER_TYPE_MT2032)
{
MT2032_tune(f, (1.0*frequency)/16.0, 0.0625);
} else
{
else
FI1236_tune(f, frequency);
}
if(!f->afc_timer_installed)
{
if (!f->afc_timer_installed) {
f->afc_timer_installed=TRUE;
/* RegisterBlockAndWakeupHandlers(FI1236_BlockHandler, AFCWakeup, f); */
TimerSet(NULL, 0, 300, AFC_TimerCallback, f);
@ -554,52 +611,65 @@ void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency)
}
int FI1236_AFC(FI1236Ptr f)
int
FI1236_AFC(FI1236Ptr f)
{
#if 0
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: f=%p f->count=%d f->original_frequency=%d f->afc_delta=%d\n", f, f->afc_count, f->original_frequency, f->afc_delta);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"AFC: f=%p f->count=%d f->original_frequency=%d f->afc_delta=%d\n",
f, f->afc_count, f->original_frequency, f->afc_delta);
#endif
f->afc_count++;
if(f->type==TUNER_TYPE_MT2032)
{
if (f->type == TUNER_TYPE_MT2032) {
f->last_afc_hint = MT2032_get_afc_hint(f);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: afc_hint=%d\n", f->last_afc_hint);
if(f->last_afc_hint==TUNER_TUNED)return 0;
if(f->afc_count>3)f->last_afc_hint=TUNER_OFF;
if(f->last_afc_hint==TUNER_OFF)
{
f->afc_delta=0;
} else
f->afc_delta+=f->last_afc_hint;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: Setting tuner frequency to %g\n", (0.5*(2*f->original_frequency+f->afc_delta))/16.0);
MT2032_tune(f, (1.0*f->original_frequency+0.5*f->afc_delta)/16.0, 0.03125);
if(f->last_afc_hint==TUNER_OFF)return 0;
return 1; /* call me again */
} else
{
f->last_afc_hint=FI1236_get_afc_hint(f);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"AFC: afc_hint=%d\n", f->last_afc_hint);
if (f->last_afc_hint == TUNER_TUNED)
{
return 0;
if (f->afc_count > 3)
f->last_afc_hint = TUNER_OFF;
if (f->last_afc_hint == TUNER_OFF)
f->afc_delta = 0;
else
f->afc_delta += f->last_afc_hint;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"AFC: Setting tuner frequency to %g\n",
(0.5 * (2 * f->original_frequency + f->afc_delta)) / 16.0);
MT2032_tune(f,
(1.0 * f->original_frequency+ 0.5 * f->afc_delta) / 16.0,
0.03125);
if (f->last_afc_hint == TUNER_OFF)
return 0;
return 1; /* call me again */
} else {
f->last_afc_hint = FI1236_get_afc_hint(f);
if (f->last_afc_hint == TUNER_TUNED) {
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: TUNER_TUNNED\n");
return 0;
}
if(f->afc_count>3)f->last_afc_hint=TUNER_OFF;
if (f->afc_count > 3)
f->last_afc_hint = TUNER_OFF;
if (f->last_afc_hint == TUNER_OFF)
{
f->afc_delta=0;
} else
else
f->afc_delta+=f->last_afc_hint;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: Setting tuner frequency to %g\n", (0.5*(2*f->original_frequency+f->afc_delta))/16.0);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"AFC: Setting tuner frequency to %g\n",
(0.5 * (2 * f->original_frequency + f->afc_delta)) / 16.0);
FI1236_tune(f, f->original_frequency + f->afc_delta);
if(f->last_afc_hint==TUNER_OFF)return 0;
if (f->last_afc_hint == TUNER_OFF)
return 0;
return 1; /* call me again */
}
return 0; /* done */
}
void fi1236_dump_status(FI1236Ptr f)
void
fi1236_dump_status(FI1236Ptr f)
{
if(f->type==TUNER_TYPE_MT2032){
if (f->type == TUNER_TYPE_MT2032)
MT2032_dump_status(f);
}
}

View File

@ -334,6 +334,10 @@ as root (i.e, with real-uid 0).
.B \-nosilk
Disable Silken Mouse support.
.TP 8
.B \-novtswitch
Disable the automatic switching on X server reset and shutdown to the
VT that was active when the server started, if supported by the OS.
.TP 8
.B \-pixmap24
Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel.
The default is usually 32 bits per pixel. There is normally little
@ -376,6 +380,9 @@ and
.B \-ggamma
options.
.TP 8
.B \-sharevts
Share virtual terminals with another X server, if supported by the OS.
.TP 8
.BI \-screen " screen-name"
Use the __xconfigfile__(__filemansuffix__) file
.B Screen

View File

@ -45,7 +45,6 @@ static int devConsoleFd = -1;
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
static int VTnum = -1;
static int initialVT = -1;
static Bool ShareVTs = FALSE;
#endif
#ifdef PCCONS_SUPPORT
@ -266,7 +265,7 @@ xf86OpenConsole()
}
#endif
acquire_vt:
if (!ShareVTs) {
if (!xf86Info.ShareVTs) {
/*
* now get the VT
*/
@ -304,7 +303,7 @@ acquire_vt:
{
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
}
} else { /* ShareVTs */
} else { /* xf86Info.ShareVTs */
close(xf86Info.consoleFd);
}
break;
@ -320,7 +319,8 @@ acquire_vt:
{
/* serverGeneration != 1 */
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
if (!ShareVTs) if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
if (!xf86Info.ShareVTs &&
(xf86Info.consType == SYSCONS || xf86Info.consType == PCVT))
{
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
{
@ -393,7 +393,7 @@ xf86OpenSyscons()
if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
initialVT = -1;
#endif
if (ShareVTs)
if (xf86Info.ShareVTs)
xf86Info.vtno = initialVT;
if (xf86Info.vtno == -1)
@ -655,7 +655,7 @@ xf86CloseConsole()
struct vt_mode VT;
#endif
if (ShareVTs) return;
if (xf86Info.ShareVTs) return;
switch (xf86Info.consType)
{
@ -723,11 +723,6 @@ xf86ProcessArgument(int argc, char *argv[], int i)
return 1;
}
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
if (!strcmp(argv[i], "-sharevts"))
{
ShareVTs = TRUE;
return 1;
}
if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
{
if (sscanf(argv[i], "vt%2d", &VTnum) == 0 ||

View File

@ -39,8 +39,6 @@
#include <sys/stat.h>
static Bool KeepTty = FALSE;
static Bool VTSwitch = TRUE;
static Bool ShareVTs = FALSE;
static int activeVT = -1;
static char vtname[11];
@ -109,7 +107,7 @@ xf86OpenConsole(void)
"xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
strerror(errno));
if (ShareVTs)
if (xf86Info.ShareVTs)
{
SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
if (ret < 0)
@ -184,7 +182,7 @@ xf86OpenConsole(void)
}
#endif
if (!ShareVTs)
if (!xf86Info.ShareVTs)
{
struct termios nTty;
@ -240,7 +238,7 @@ xf86OpenConsole(void)
* of Init?$#*&Device(). So I just place it here */
}
} else { /* serverGeneration != 1 */
if (!ShareVTs && VTSwitch)
if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch)
{
/* now get the VT */
switch_to(xf86Info.vtno, "xf86OpenConsole");
@ -254,7 +252,7 @@ xf86CloseConsole(void)
struct vt_mode VT;
int ret;
if (ShareVTs) {
if (xf86Info.ShareVTs) {
close(xf86Info.consoleFd);
return;
}
@ -286,7 +284,7 @@ xf86CloseConsole(void)
strerror(errno));
}
if (VTSwitch)
if (xf86Info.autoVTSwitch)
{
/*
* Perform a switch back to the active VT when we were started
@ -311,16 +309,7 @@ xf86ProcessArgument(int argc, char *argv[], int i)
KeepTty = TRUE;
return 1;
}
if (!strcmp(argv[i], "-novtswitch"))
{
VTSwitch = FALSE;
return 1;
}
if (!strcmp(argv[i], "-sharevts"))
{
ShareVTs = TRUE;
return 1;
}
if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
{
if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0)
@ -340,6 +329,4 @@ xf86UseMsg(void)
ErrorF("vtXX use the specified VT number\n");
ErrorF("-keeptty ");
ErrorF("don't detach controlling tty (for debugging only)\n");
ErrorF("-novtswitch don't immediately switch to new VT\n");
ErrorF("-sharevts share VTs with another X server\n");
}

View File

@ -63,6 +63,22 @@ static char consoleDev[PATH_MAX] = "/dev/fb";
Used by hw/xfree86/common/xf86AutoConfig.c for VIS_GETIDENTIFIER */
_X_HIDDEN char xf86SolarisFbDev[PATH_MAX] = "/dev/fb";
static void
switch_to(int vt, const char *from)
{
int ret;
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
if (ret != 0)
xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n",
from, strerror(errno));
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
if (ret != 0)
xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n",
from, strerror(errno));
}
void
xf86OpenConsole(void)
{
@ -170,6 +186,11 @@ xf86OpenConsole(void)
xf86Info.vtno = VTnum;
from = X_CMDLINE;
}
else if (xf86Info.ShareVTs)
{
xf86Info.vtno = vtinfo.v_active;
from = X_CMDLINE;
}
else
{
if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
@ -201,16 +222,15 @@ OPENCONSOLE:
chown(consoleDev, getuid(), getgid());
#ifdef HAS_USL_VTS
if (xf86Info.ShareVTs)
return;
if (vtEnabled)
{
/*
* Now get the VT
*/
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
switch_to(xf86Info.vtno, "xf86OpenConsole");
#ifdef VT_SET_CONSUSER /* added in snv_139 */
if (strcmp(display, "0") == 0)
@ -249,16 +269,13 @@ OPENCONSOLE:
else /* serverGeneration != 1 */
{
#ifdef HAS_USL_VTS
if (vtEnabled)
if (vtEnabled && !xf86Info.ShareVTs)
{
/*
* Now re-get the VT
*/
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
if (xf86Info.autoVTSwitch)
switch_to(xf86Info.vtno, "xf86OpenConsole");
#ifdef VT_SET_CONSUSER /* added in snv_139 */
if (strcmp(display, "0") == 0)
@ -347,7 +364,8 @@ xf86CloseConsole(void)
}
/* Activate the VT that X was started on */
ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86StartVT);
if (xf86Info.autoVTSwitch)
switch_to(xf86StartVT, "xf86CloseConsole");
}
#endif /* HAS_USL_VTS */

View File

@ -1,4 +1,3 @@
.\" $XFree86$
.TH CVT 1 __vendorversion__
.SH NAME
cvt - calculate VESA CVT mode lines
@ -32,7 +31,7 @@ Create a mode with reduced blanking. This allows for higher frequency signals,
with a lower or equal dotclock. Not for Cathode Ray Tube based displays though.
.SH "SEE ALSO"
__xconfigfile__(__filemansuffix__)
__xconfigfile__(__filemansuffix__), gtf(__appmansuffix__)
.SH AUTHOR
Luc Verhaegen.
.PP

View File

@ -1,4 +1,3 @@
.\" $XFree86$
.TH GTF 1 __vendorversion__
.SH NAME
gtf - calculate VESA GTF mode lines
@ -35,7 +34,7 @@ default format.
Print the mode parameters in a format suitable for
.BR fbset(8) .
.SH "SEE ALSO"
__xconfigfile__(__filemansuffix__)
__xconfigfile__(__filemansuffix__), cvt(__appmansuffix__)
.SH AUTHOR
Andy Ritger.
.PP

View File

@ -57,12 +57,11 @@ extern _X_EXPORT void ReplyNotSwappd (
void * /* pbuf */) _X_NORETURN;
typedef enum {ClientStateInitial,
ClientStateAuthenticating,
ClientStateRunning,
/* 1 is unused now, was ClientStateAuthenticating */
ClientStateRunning = 2,
ClientStateRetained,
ClientStateGone,
ClientStateCheckingSecurity,
ClientStateCheckedSecurity} ClientState;
ClientStateGone
} ClientState;
#ifdef XFIXES
typedef struct _saveSet {