char tmp[20] = {0};
snprintf(tmp, sizeof(tmp), "\"TP%02d%c\":\"%d\"",
data[i], loc[j], ts->pressure_data[data[i]][j]);
- strncat(buff, tmp, sizeof(tmp));
+ strlcat(buff, tmp, sizeof(buff));
if (i < 3 || j < PRESSURE_CHANNEL_NUM - 1)
strncat(buff, ",", 2);
}
for (i = 0; i < ts->tx_count; i++) {
snprintf(temp, sizeof(temp), "\"TAMB_TX%02d\":\"%d\",",
i, ts->ambient_tx[i]);
- strncat(buffer, temp, sizeof(temp));
+ strlcat(buffer, temp, (ts->tx_count + ts->rx_count) * 25);
}
for (i = 0; i < ts->rx_count; i++) {
snprintf(temp, sizeof(temp), "\"TAMB_RX%02d\":\"%d\"",
i, ts->ambient_rx[i]);
- strncat(buffer, temp, sizeof(temp));
+ strlcat(buffer, temp, (ts->tx_count + ts->rx_count) * 25);
if (i != (ts->rx_count - 1))
strncat(buffer, ",", 2);
}
for (i = 0; i < ts->tx_count; i++) {
snprintf(temp, sizeof(temp), "\"TCDT%02d\":\"%d\",",
i, ts->ambient_tx_delta[i]);
- strncat(buffer, temp, sizeof(temp));
+ strlcat(buffer, temp, (ts->tx_count + ts->rx_count) * 25);
}
for (i = 0; i < ts->rx_count; i++) {
snprintf(temp, sizeof(temp), "\"TCDR%02d\":\"%d\"",
i, ts->ambient_rx_delta[i]);
- strncat(buffer, temp, sizeof(temp));
+ strlcat(buffer, temp, (ts->tx_count + ts->rx_count) * 25);
if (i != (ts->rx_count - 1))
strncat(buffer, ",", 2);
}
snprintf(buff, sizeof(buff),
"%d: %04x%04x%04x%04x\n",
string_addr, data0, data1, data2, data3);
- strncat(buf, buff, sizeof(buff));
+ strlcat(buf, buff, PAGE_SIZE);
}
}
return snprintf(buf, SEC_CMD_BUF_SIZE, "%s\n", buff);
snprintf(temp, sizeof(temp), "mutual,%d,", data[0] & 0x01 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "hover,%d,", data[0] & 0x02 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "cover,%d,", data[0] & 0x04 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "glove,%d,", data[0] & 0x08 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "stylus,%d,", data[0] & 0x10 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "palm,%d,", data[0] & 0x20 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "wet,%d,", data[0] & 0x40 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "prox,%d,", data[0] & 0x80 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
memset(data, 0x00, 2);
ret = ts->sec_ts_i2c_read(ts, SEC_TS_CMD_SET_POWER_MODE, data, 1);
return snprintf(buf, SEC_CMD_BUF_SIZE, "%s\n", buff);
snprintf(temp, sizeof(temp), "npm,%d,", data[0] == 0 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "lpm,%d,", data[0] == 1 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "test,%d,", data[0] == 2 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "flash,%d,", data[0] == 3 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
memset(data, 0x00, 2);
ret = ts->sec_ts_i2c_read(ts, SET_TS_CMD_SET_CHARGER_MODE, data, 1);
return snprintf(buf, SEC_CMD_BUF_SIZE, "%s\n", buff);
snprintf(temp, sizeof(temp), "no_charge,%d,", data[0] == 0 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "wire_charge,%d,", data[0] == 1 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "wireless_charge,%d,", data[0] == 2 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
memset(data, 0x00, 2);
ret = ts->sec_ts_i2c_read(ts, SET_TS_CMD_SET_NOISE_MODE, data, 1);
return snprintf(buf, SEC_CMD_BUF_SIZE, "%s\n", buff);
snprintf(temp, sizeof(temp), "noise,%d,", data[0]);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
memset(data, 0x00, 2);
ret = ts->sec_ts_i2c_read(ts, SEC_TS_CMD_SET_COVERTYPE, data, 1);
return snprintf(buf, SEC_CMD_BUF_SIZE, "%s\n", buff);
snprintf(temp, sizeof(temp), "cover_type,%d,", data[0]);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
memset(data, 0x00, 2);
ret = ts->sec_ts_read_sponge(ts, data, 1);
return snprintf(buf, SEC_CMD_BUF_SIZE, "%s\n", buff);
snprintf(temp, sizeof(temp), "pressure,%d,", data[0] & 0x40 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "aod,%d,", data[0] & 0x04 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "spay,%d,", data[0] & 0x02 ? 1 : 0);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
snprintf(temp, sizeof(temp), "singletap,%d,", data[0] & 0x08 ? 1 : 0);
strncat(buff, temp, sizeof(temp));
return snprintf(buf, SEC_CMD_BUF_SIZE, "%s\n", buff);
snprintf(temp, sizeof(temp), "dex,%d,", data[0]);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
data[0] = 0;
return snprintf(buf, SEC_CMD_BUF_SIZE, "%s\n", buff);
snprintf(temp, sizeof(temp), "artcanvas,%d,", data[0]);
- strncat(buff, temp, sizeof(temp));
+ strlcat(buff, temp, sizeof(buff));
input_info(true, &ts->client->dev, "%s: %s\n", __func__, buff);
for (i = 0; i < info->ForceChannelLength; i++) {
snprintf(temp, sizeof(temp), "\"TAMB_TX%02d\":\"%d\",",
i, info->baseline_tx[i]);
- strncat(buffer, temp, sizeof(temp));
+ strlcat(buffer, temp, (info->ForceChannelLength + info->SenseChannelLength) * 25);
}
for (i = 0; i < info->SenseChannelLength; i++) {
snprintf(temp, sizeof(temp), "\"TAMB_RX%02d\":\"%d\"",
i, info->baseline_rx[i]);
if (strnlen(buffer, (info->ForceChannelLength + info->SenseChannelLength) * 25) <= 893) {
- strncat(buffer, temp, sizeof(temp));
+ strlcat(buffer, temp, (info->ForceChannelLength + info->SenseChannelLength) * 25);
if (i != (info->SenseChannelLength - 1))
strncat(buffer, ",", 2);
}
for (i = 0; i < info->ForceChannelLength; i++) {
snprintf(temp, sizeof(temp), "\"TCDT%02d\":\"%d\",",
i, info->baseline_tx_delta[i]);
- strncat(buffer, temp, sizeof(temp));
+ strlcat(buffer, temp, (info->ForceChannelLength + info->SenseChannelLength) * 25);
}
for (i = 0; i < info->SenseChannelLength; i++) {
snprintf(temp, sizeof(temp), "\"TCDR%02d\":\"%d\"",
i, info->baseline_rx_delta[i]);
- strncat(buffer, temp, sizeof(temp));
+ strlcat(buffer, temp, (info->ForceChannelLength + info->SenseChannelLength) * 25);
if (i != (info->SenseChannelLength - 1))
strncat(buffer, ",", 2);
}
snprintf(buff, sizeof(buff),
"%d: %04x%04x%04x%04x\n",
(string_addr - FTS_CMD_STRING_ACCESS), data0, data1, data2, data3);
- strncat(buf, buff, sizeof(buff));
+ strlcat(buf, buff, PAGE_SIZE);
}
}
for (j = 0; j < info->SenseChannelLength; j++) {
snprintf(buff, sizeof(buff), "%d,", info->pFrame[(i * info->SenseChannelLength) + j]);
- strncat(all_strbuff, buff, sizeof(buff));
+ strlcat(all_strbuff, buff, sizeof(all_strbuff));
}
}
for(i = 0; i < rx_num; i++){
info->cx_data[(j * rx_num) + i] = ReadData[j][i + 1];
snprintf(buff, sizeof(buff), "%d,", ReadData[j][i + 1]);
- strncat(all_strbuff, buff, sizeof(buff));
+ strlcat(all_strbuff, buff, sizeof(all_strbuff));
}
}
}