/* -- SAM interface. -------------------------------------------------------- */
/* * Available sensors are indicated by a 16-bit bitfield, where a 1 marks the * presence of a sensor. So we have at most 16 possible sensors/channels.
*/ #define SSAM_TMP_SENSOR_MAX_COUNT 16
/* * All names observed so far are 6 characters long, but there's only * zeros after the name, so perhaps they can be longer. This number reflects * the maximum zero-padded space observed in the returned buffer.
*/ #define SSAM_TMP_SENSOR_NAME_LENGTH 18
status = __ssam_tmp_get_name(sdev->ctrl, sdev->uid.target, iid, &name_rsp); if (status) return status;
/* * This should not fail unless the name in the returned struct is not * null-terminated or someone changed something in the struct * definitions above, since our buffer and struct have the same * capacity by design. So if this fails, log an error message. Since * the more likely cause is that the returned string isn't * null-terminated, we might have received garbage (as opposed to just * an incomplete string), so also fail the function.
*/
status = strscpy(buf, name_rsp.name, buf_len); if (status < 0) {
dev_err(&sdev->dev, "received non-null-terminated sensor name string\n"); return status;
}
/* Retrieve the name for each available sensor. */ for (channel = 0; channel < SSAM_TMP_SENSOR_MAX_COUNT; channel++) { if (!(sensors & BIT(channel))) continue;
status = ssam_tmp_get_name(sdev, channel + 1, ssam_temp->names[channel],
SSAM_TMP_SENSOR_NAME_LENGTH); if (status) return status;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.