centos 7
obsolete weakness #298

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

gpm-1.20.7/src/synaptics.c

Context:

The highlighted line of code below is the trigger point of this particular Centos 7 obsolete weakness.

   gpm_report(GPM_PR_DEBUG,"Reseting Synaptic PS/2 %s\n",(stick?"Stick":"Touchpad"));

  /* Send reset command without eating the ack. */
  if(!stick) {
    write(fd,&reset_cmd,1);
    status = tp_ps2_getbyte(fd);
  } else {
    syn_ps2_putbyte(fd, stick, reset_cmd);
    status = PS2_ACK;
  }

  /* Sometimes the touchpad sends additional ready,idcode before ack the reset command.
   * I dont know why! */
  while (status == PS2_READY){
    gpm_report(GPM_PR_INFO,"PS/2 device sending additional READY, ID CODE.\n");
    id_code = syn_ps2_getbyte(fd,stick);
    status  = syn_ps2_getbyte(fd,stick);
  }

  if (status != PS2_ACK || id_code != PS2_MOUSE_IDCODE){
    gpm_report(GPM_PR_ERR,"Sending reset command to PS/2 Device failed: No ACK, got %02X.\n",status);
  }

  /* Wait 750 ms to recalibrate. */
  usleep(750000);

  if ( (status  = syn_ps2_getbyte(fd,stick)) != PS2_READY ){
    gpm_report(GPM_PR_ERR,"Reseting PS/2 Device failed: No READY, got %02X.\n"
	                  "Check pc_keyb.c for reconnect smartness.\n",status);
  }
  if ( (id_code = syn_ps2_getbyte(fd,stick)) != PS2_MOUSE_IDCODE){
    gpm_report(GPM_PR_ERR,"Reseting PS/2 Device failed: Wrong ID, got %02X.\n",id_code);
  }

}


/*
** syn_ps2_absolute_mode
**
** Put the touchpad into absolute mode.
*/

static void syn_ps2_absolute_mode(int fd)
{

  /* select 6 byte packet, high packet rate, no-sleep */
  syn_ps2_set_mode2 (fd, DEVICE_TOUCHPAD, 
		     (ABSOLUTE_MODE    |
		      HIGH_REPORT_RATE | 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.