static void check_tx_to_gnd(struct synaptics_drv_data *data)
{
	int i = 0;
	u8 length = (data->x_line / 8) + 1;

	if (NULL == data->tx_to_gnd)
		data->tx_to_gnd = kzalloc(data->x_line, GFP_KERNEL);

	/* set the index */
	set_report_index(data, 0x0000);

	/* Set the GetReport bit to run the AutoScan */
	set_report_mode(data, 0x01, 0x00);

	synaptics_ts_read_block(data,
		data->f54.data_base_addr + 3,
		data->tx_to_gnd, length);

	/*
	* Byte-0 houses Tx responses Tx7:Tx0
	* Byte-1 houses Tx responses Tx15:Tx8
	* Byte-2 houses Tx responses Tx23:Tx16
	* Byte-3 houses Tx responses Tx31:Tx24
	*/
	for (i = 0; i < data->x_line; i++) {
		if (data->tx_to_gnd[i / 8] & (0x1 << i % 8)) {
			data->tx_to_gnd[i] = 0x1;
			printk(KERN_WARNING
				"[TSP] %s %d short\n",
				__func__, i);
		} else
			data->tx_to_gnd[i] = 0x0;
	}
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: bobbens/cwiid
void chkIR_toggled(void)
{
	if (wiimote) {
		set_report_mode();
	}
	if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkIR))) {
		clear_ir_data();
	}
	set_gui_state();
}
Ejemplo n.º 3
0
Archivo: main.c Proyecto: bobbens/cwiid
void chkAcc_toggled(void)
{
	if (wiimote) {
		set_report_mode();
	}
	if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkAcc))) {
		clear_acc_widgets();
	}
	set_gui_state();
}
Ejemplo n.º 4
0
Archivo: main.c Proyecto: bobbens/cwiid
void chkExt_toggled(void)
{
	if (wiimote) {
		set_report_mode();
	}
	if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkExt))) {
		clear_nunchuk_widgets();
		clear_classic_widgets();
		clear_motionplus_widgets();
	}
	set_gui_state();
}
static void check_delta_cap(struct synaptics_drv_data *data)
{
	int i, k=0;
	u16 temp = 0;
	u16 length;
	u8 escape_rx_line;
    u8 *btn_data;
	int start_button_data;

	if (data->pdata->support_extend_button)
		escape_rx_line = data->pdata->extend_button_map->nbuttons;
	else
		escape_rx_line = data->pdata->button_map->nbuttons;

	length = escape_rx_line * 2;

    btn_data = kzalloc(length, GFP_KERNEL);

	data->refer_min = 0xffff;
	data->refer_max = 0x0;

	start_button_data = ((data->x_line * (data->y_line + escape_rx_line)) + data->y_line) * 2;

	/* set the index */
	set_report_index(data, start_button_data);

	/* Set the GetReport bit to run the AutoScan */
	set_report_mode(data, 0x01, 0x00);

	/* read all report data */
	synaptics_ts_read_block(data,
		data->f54.data_base_addr + 3,
		btn_data, length);

	for (i = 0; i < escape_rx_line; i++) {
		temp = (u16)(btn_data[k] | (btn_data[k+1] << 8));
		printk(KERN_DEBUG "[TSP] index[btn:%d] data[0x%x]\n", i, temp);

		if (temp > BUTTON_THRESHOLD_LIMIT)
			data->pdata->button_pressure[i] = BUTTON_THRESHOLD_MIN;
		else
			data->pdata->button_pressure[i] = temp;
		k = k + 2;
	}

    kfree(btn_data);
}
Ejemplo n.º 6
0
Archivo: main.c Proyecto: bobbens/cwiid
void menuConnect_activate(void)
{
	char reset_bdaddr = 0;

	if (bacmp(&bdaddr, BDADDR_ANY) == 0) {
		reset_bdaddr = 1;
	}
	message(GTK_MESSAGE_INFO,
	        "Put Wiimote in discoverable mode (press 1+2) and press OK",
	         GTK_WINDOW(winMain));
	if ((wiimote = cwiid_open(&bdaddr, CWIID_FLAG_MESG_IFC)) == NULL) {
		message(GTK_MESSAGE_ERROR, "Unable to connect", GTK_WINDOW(winMain));
		status("No connection");
	}
	else if (cwiid_set_mesg_callback(wiimote, &cwiid_callback)) {
		message(GTK_MESSAGE_ERROR, "Error setting callback",
		        GTK_WINDOW(winMain));
		if (cwiid_close(wiimote)) {
			message(GTK_MESSAGE_ERROR, "Error on disconnect",
			        GTK_WINDOW(winMain));
		}
		wiimote = NULL;
		status("No connection");
	}
	else {
		status("Connected");
		if (cwiid_get_acc_cal(wiimote, CWIID_EXT_NONE, &wm_cal)) {
			message(GTK_MESSAGE_ERROR, "Unable to retrieve accelerometer "
			        "calibration", GTK_WINDOW(winMain));
		}
		set_gui_state();
		set_report_mode();
		cwiid_enable(wiimote, CWIID_FLAG_MOTIONPLUS);
		cwiid_request_status(wiimote);
	}

	if (reset_bdaddr) {
		bdaddr = *BDADDR_ANY;
	}
}
static void check_rx_to_rx(struct synaptics_drv_data *data)
{
	int i = 0, j = 0, k = 0;
	u8 *buff;
	u16 length = data->y_line * data->y_line * 2;
	u16 temp = 0;

	buff = kzalloc(length, GFP_KERNEL);

	/* disable the CBC setting */
	synaptics_ts_write_data(data,
		data->f54.control_base_addr + 8,
		0x00);

	/* noCDM4 */
	synaptics_ts_write_data(data,
		data->f54.control_base_addr + 0xa6,
		0x01);

	set_report_mode(data, 0x04, 0x00);
	set_report_mode(data, 0x02, 0x00);

	/* set the index */
	set_report_index(data, 0x0000);

	/* Set the GetReport bit to run the AutoScan */
	set_report_mode(data, 0x01, 0x00);

	/* read 1st rx_to_rx data */
	length = data->x_line * data->y_line * 2;

	synaptics_ts_read_block(data,
		data->f54.data_base_addr + 3,
		buff, length);

	for (i = 0, k = 0; i < data->x_line; i++) {
		for (j = 0; j < data->y_line; j++, k += 2) {
			temp = buff[k] | (buff[k+1] << 8);
			data->rx_to_rx[i][j] = temp;
		}
	}

	/* read 2nd rx_to_rx data */
	length = data->y_line *
		(data->y_line - data->x_line) * 2;

	set_report_type(data,
		REPORT_TYPE_RX_TO_RX2);

	/* set the index */
	set_report_index(data, 0x0000);

	set_report_mode(data, 0x01, 0x00);

	synaptics_ts_read_block(data,
		data->f54.data_base_addr + 3,
		buff, length);

	for (k = 0; i < data->y_line; i++) {
		for (j = 0; j < data->y_line; j++, k += 2) {
			temp = buff[k] | (buff[k+1] << 8);
			data->rx_to_rx[i][j] = temp;
		}
	}

	if (data->debug) {
		for (i = 0; i < data->y_line; i++) {
			printk("[TSP] line %d :", i);
			for (j = 0; j < data->y_line; j++)
				printk(" %d", (s16)(data->rx_to_rx[j][i]));
			printk("\n");
		}
	}

	/* to the calibration */
	set_report_mode(data, 0x02, 0x00);

	kfree(buff);
}
static void check_all_raw_cap(struct synaptics_drv_data *data)
{
	int i, j, k=0;
	u16 temp = 0;
	u16 length;

#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_S7301_KEYS)
	u8 escape_rx_line;

	if (data->pdata->support_extend_button)
		escape_rx_line = data->pdata->extend_button_map->nbuttons;
	else
		escape_rx_line = data->pdata->button_map->nbuttons;

	length = data->x_line * (data->y_line + escape_rx_line) * 2;

	if (NULL == data->references)
		data->references = kzalloc(length, GFP_KERNEL);

	data->refer_min = 0xffff;
	data->refer_max = 0x0;

	/* set the index */
	set_report_index(data, 0x0000);

	/* Set the GetReport bit to run the AutoScan */
	set_report_mode(data, 0x01, 0x00);

	/* read all report data */
	synaptics_ts_read_block(data,
		data->f54.data_base_addr + 3,
		data->references, length);

	for (i = 0; i < data->x_line; i++) {
		for (j = 0; j < data->y_line + escape_rx_line; j++) {
			temp = (u16)(data->references[k] |
				(data->references[k+1] << 8));

			if (k != 0 && j !=0) {
				if (j >= data->y_line) {
					if (data->debug) {
						printk(KERN_DEBUG
							"[TSP][skip] raw cap[%d] : %u\n",
							k, temp);
					}
					k += 2;
					continue;
				}
			}
			if (data->debug) {
				if (data->debug) {
					printk(KERN_DEBUG
						"[TSP] raw cap[%d] : %u\n",
						k, temp);
				}
			}
			if (temp < data->refer_min)
				data->refer_min = temp;
			if (temp > data->refer_max)
				data->refer_max = temp;
			k += 2;
		}
	}
#else
	length = data->x_line * data->y_line * 2;

	if (NULL == data->references)
		data->references = kzalloc(length, GFP_KERNEL);

	data->refer_min = 0xffff;
	data->refer_max = 0x0;

	/* set the index */
	set_report_index(data, 0x0000);

	/* Set the GetReport bit to run the AutoScan */
	set_report_mode(data, 0x01, 0x00);

	/* read all report data */
	synaptics_ts_read_block(data,
		data->f54.data_base_addr + 3,
		data->references, length);

	for (i = 0; i < length; i += 2) {
		temp = (u16)(data->references[i] |
			(data->references[i+1] << 8));
		if (data->debug) {
			if ((temp <= FULL_RAW_CAP_LOWER_LIMIT)
				|| (temp >= FULL_RAW_CAP_UPPER_LIMIT)) {
				printk(KERN_DEBUG
					"[TSP] raw cap[%d] : %u\n",
					i, temp);
			}
		}
		if (temp < data->refer_min)
			data->refer_min = temp;
		if (temp > data->refer_max)
			data->refer_max = temp;
	}
#endif
	printk(KERN_DEBUG "[TSP] min : %u, max : %u\n",
		data->refer_min, data->refer_max);
}