mirror of
https://gitlab.freedesktop.org/emersion/libdisplay-info.git
synced 2024-11-16 19:48:30 +01:00
7a6d694b1a
Establish the new headers and structs, and just parse the version/revision for now. Signed-off-by: Simon Ser <contact@emersion.fr>
35 lines
668 B
C
35 lines
668 B
C
#include <errno.h>
|
|
|
|
#include "bits.h"
|
|
#include "displayid.h"
|
|
|
|
bool
|
|
_di_displayid_parse(struct di_displayid *displayid, const uint8_t *data,
|
|
size_t size, struct di_logger *logger)
|
|
{
|
|
if (size < 5) {
|
|
errno = EINVAL;
|
|
return false;
|
|
}
|
|
|
|
displayid->version = get_bit_range(data[0x00], 7, 4);
|
|
displayid->revision = get_bit_range(data[0x00], 3, 0);
|
|
if (displayid->version == 0 || displayid->version > 1) {
|
|
errno = ENOTSUP;
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
int
|
|
di_displayid_get_version(const struct di_displayid *displayid)
|
|
{
|
|
return displayid->version;
|
|
}
|
|
|
|
int
|
|
di_displayid_get_revision(const struct di_displayid *displayid)
|
|
{
|
|
return displayid->revision;
|
|
}
|