Esempio n. 1
0
static void handle_VW2_event(int event, void *dev_data)
{
	uint8_t irq_status, beh_data;
	struct ocd_info *cinfo = (struct ocd_info *)dev_data;
	int ret;

	dev_info(cinfo->dev, "EM:BCU: BCU Event %d has occured\n", event);
	/* Notify using UEvent */
	kobject_uevent(&cinfo->dev->kobj, KOBJ_CHANGE);

	ret = intel_scu_ipc_ioread8(S_BCUINT, &irq_status);
	if (ret)
		goto ipc_fail;
	dev_dbg(cinfo->dev, "EM:BCU: S_BCUINT: %x\n", irq_status);

	/* If Vsys is below WARN2 level-No action required from driver */
	if (!(irq_status & SVWARN2)) {
		/* Vsys is above WARN2 level */
		ret = intel_scu_ipc_ioread8(CAMFLDIS_BEH, &beh_data);
		if (ret)
			goto ipc_fail;

		if (IS_ASSRT_ON_VW2(beh_data) && IS_STICKY(beh_data)) {
			ret = intel_scu_ipc_update_register(S_BCUCTRL,
						0xFF, SBCUCTRL_CAMFLDIS);
			if (ret)
				goto ipc_fail;
		}

		ret = intel_scu_ipc_ioread8(BCUDISW2_BEH, &beh_data);
		if (ret)
			goto ipc_fail;

		if (IS_ASSRT_ON_VW2(beh_data) && IS_STICKY(beh_data)) {
			ret = intel_scu_ipc_update_register(S_BCUCTRL,
				0xFF, SBCUCTRL_BCUDISW2);
			if (ret)
				goto ipc_fail;
		}
	}
	return;

ipc_fail:
	dev_err(cinfo->dev, "EM:BCU: ipc read/write failed:func:%s()\n",
								__func__);
	return;
}
Esempio n. 2
0
File: FvwmSave.c Progetto: att/uwin
/***********************************************************************
 *
 *  Procedure:
 *	checks to see if we are supposed to take some action now,
 *      finds time for next action to be performed.
 *
 ***********************************************************************/
void do_save(void)
{
  struct list *t;
  char tname[200],loc[30];
  FILE *out;
  char **command_list;
  int dwidth,dheight,xtermline = 0;
  int x1,x2,y1,y2,i,command_count;
  long tVx, tVy;

  sprintf(tname, "%s/new.xinitrc", getenv( "HOME" ) );
  out = fopen( tname, "w+" );
  for (t = list_root; t != NULL; t = t->next)
  {
    tname[0]=0;

    x1 = t->frame_x;
    x2 = ScreenWidth - x1 - t->frame_width - 2;
    if(x2 < 0)
      x2 = 0;
    y1 = t->frame_y;
    y2 = ScreenHeight - y1 -  t->frame_height - 2;
    if(y2 < 0)
      y2 = 0;
    dheight = t->frame_height - t->title_height - 2*t->boundary_width;
    dwidth = t->frame_width - 2*t->boundary_width;
    dwidth -= t->base_width ;
    dheight -= t->base_height ;
    dwidth /= t->width_inc;
    dheight /= t->height_inc;

    if (IS_STICKY(t))
    {
      tVx = 0;
      tVy = 0;
    }
    else
    {
      tVx = Vx;
      tVy = Vy;
    }
    sprintf(tname,"%dx%d",dwidth,dheight);
    if ((t->gravity == EastGravity) ||
	(t->gravity == NorthEastGravity) ||
	(t->gravity == SouthEastGravity))
      sprintf(loc,"-%d",x2);
    else
      sprintf(loc,"+%d",x1+(int)tVx);
    strcat(tname, loc);

    if((t->gravity == SouthGravity)||
       (t->gravity == SouthEastGravity)||
       (t->gravity == SouthWestGravity))
      sprintf(loc,"-%d",y2);
    else
      sprintf(loc,"+%d",y1+(int)tVy);
    strcat(tname, loc);

    if ( XGetCommand( dpy, t->id, &command_list, &command_count ) )
    {
      for (i=0; i < command_count; i++)
      {
	if ( strncmp( "-geo", command_list[i], 4) == 0)
	{
	  i++;
	  continue;
	}
	if ( strncmp( "-ic", command_list[i], 3) == 0)
	  continue;
	if ( strncmp( "-display", command_list[i], 8) == 0)
	{
	  i++;
	  continue;
	}
	write_string(out,command_list[i]);
	if(strstr(command_list[i], "xterm"))
	{
	  fprintf( out, "-geometry %s ", tname );
	  if (IS_ICONIFIED(t))
	    fprintf(out, "-ic ");
	  xtermline = 1;
	}
      }
      if ( command_count > 0 )
      {
	if ( xtermline == 0 )
	{
	  if (IS_ICONIFIED(t))
	    fprintf(out, "-ic ");
	  fprintf( out, "-geometry %s &\n", tname );
	}
	else
	{
	  fprintf( out, "&\n");
	}
      }
      XFreeStringList( command_list );
      xtermline = 0;
    }
  }
  fprintf(out, "fvwm\n");
  fclose( out );
  exit(0);
}
Esempio n. 3
0
void do_save_command(FILE *out, struct list *t, int *curdesk,
                                int emit_wait, int *isfirstline)
{
  char tname[200],loc[30];
  char **command_list;
  int dwidth,dheight,xtermline = 0;
  int x1,x2,y1,y2,i,command_count;
  long tVx, tVy;

  tname[0]=0;

  x1 = t->frame_x;
  x2 = ScreenWidth - x1 - t->frame_width - 2;
  if(x2 < 0)
    x2 = 0;
  y1 = t->frame_y;
  y2 = ScreenHeight - y1 -  t->frame_height - 2;
  if(y2 < 0)
    y2 = 0;
  dheight = t->frame_height - t->title_height - 2*t->boundary_width;
  dwidth = t->frame_width - 2*t->boundary_width;
  dwidth -= t->base_width ;
  dheight -= t->base_height ;
  dwidth /= t->width_inc;
  dheight /= t->height_inc;

  if (IS_STICKY(t))
  {
    tVx = 0;
    tVy = 0;
  }
  else
  {
    tVx = Vx;
    tVy = Vy;
  }
  sprintf(tname,"%dx%d",dwidth,dheight);
  if ((t->gravity == EastGravity) ||
      (t->gravity == NorthEastGravity) ||
      (t->gravity == SouthEastGravity))
    sprintf(loc,"-%d",x2);
  else
    sprintf(loc,"+%d",x1+(int)tVx);
  strcat(tname, loc);

  if((t->gravity == SouthGravity)||
     (t->gravity == SouthEastGravity)||
     (t->gravity == SouthWestGravity))
    sprintf(loc,"-%d",y2);
  else
    sprintf(loc,"+%d",y1+(int)tVy);
  strcat(tname, loc);

  if ( XGetCommand( dpy, t->id, &command_list, &command_count ) )
  {
    if (*curdesk != t->desk)
    {
      fprintf( out, "%s\t\"I\" Desk 0 %ld\n", *isfirstline ? "" : "+",
	       t->desk);
      fflush ( out );
      if (*isfirstline) *isfirstline = 0;
      *curdesk = t->desk;
    }

    fprintf( out, "%s\t\t\"I\" Exec ",  *isfirstline ? "" : "+");
    if (*isfirstline) *isfirstline = 0;
    fflush ( out );
    for (i=0; i < command_count; i++)
    {
      if ( strncmp( "-geo", command_list[i], 4) == 0)
      {
	i++;
	continue;
      }
      if ( strncmp( "-ic", command_list[i], 3) == 0)
	continue;
      if ( strncmp( "-display", command_list[i], 8) == 0)
      {
	i++;
	continue;
      }
      write_string(out,command_list[i]);
      fflush ( out );
      if(strstr(command_list[i], "xterm"))
      {
	fprintf( out, "-geometry %s ", tname );
	if (IS_ICONIFIED(t))
	  fprintf(out, "-ic ");
	xtermline = 1;
	fflush ( out );
      }
    }
    if ( command_count > 0 )
    {
      if ( xtermline == 0 )
      {
	if (IS_ICONIFIED(t))
	  fprintf(out, "-ic ");
	fprintf( out, "-geometry %s &\n", tname);
      }
      else
      {
	fprintf( out, "&\n");
      }
    }
    if (emit_wait) {
      if (t->name)
	fprintf( out, "+\t\t\"I\" Wait %s\n", t->name);
      else fprintf( out, "+\t\t\"I\" Wait %s\n", command_list[0]);
      fflush( out );
    }
    XFreeStringList( command_list );
    xtermline = 0;
  }
}