From 78a3c99d077e34b8adcfc0265493ef4ace3a2a29 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 12 Jul 2014 09:32:19 +0200 Subject: [PATCH] libv4l2rds: Area Coverage is only partially available for RBDS RBDS supports area coverage codes only for B, D and E PI code blocks. Signed-off-by: Hans Verkuil --- lib/libv4l2rds/libv4l2rds.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/libv4l2rds/libv4l2rds.c b/lib/libv4l2rds/libv4l2rds.c index 24e113e..efc8a7d 100644 --- a/lib/libv4l2rds/libv4l2rds.c +++ b/lib/libv4l2rds/libv4l2rds.c @@ -1584,7 +1584,8 @@ const char *v4l2_rds_get_language_str(const struct v4l2_rds *handle) const char *v4l2_rds_get_coverage_str(const struct v4l2_rds *handle) { /* bits 8-11 contain the area coverage code */ - uint8_t coverage = (handle->pi >> 8) & 0X0f; + uint8_t coverage = (handle->pi >> 8) & 0x0f; + uint8_t nibble = (handle->pi >> 12) & 0x0f; static const char *coverage_lut[16] = { "Local", "International", "National", "Supra-Regional", "Regional 1", "Regional 2", "Regional 3", "Regional 4", @@ -1592,7 +1593,14 @@ const char *v4l2_rds_get_coverage_str(const struct v4l2_rds *handle) "Regional 9", "Regional 10", "Regional 11", "Regional 12" }; - return coverage_lut[coverage]; + /* + * Coverage area codes are restricted to the B, D and E PI code + * blocks for RBDS. + */ + if (!handle->is_rbds || + (nibble == 0xb || nibble == 0xd || nibble == 0xe)) + return coverage_lut[coverage]; + return "Not Available"; } const struct v4l2_rds_group *v4l2_rds_get_group(const struct v4l2_rds *handle) -- 2.7.4