if (len != sizeof(*pos))
return -1;
- if (pos->msg_id != 0xA8) /* XXX not tested */
+ if (pos->msg_id != 0xA8)
return -1;
- gps_pos.gps_week = ntohs(pos->gps_week);
- gps_pos.tow = ntohl(pos->tow);
+ /* fix endianness inside the frame */
+ pos->gps_week = ntohs(pos->gps_week);
+ pos->tow = ntohl(pos->tow);
- gps_pos.latitude = ntohl(pos->latitude);
- gps_pos.longitude = ntohl(pos->longitude);
- gps_pos.altitude = ntohl(pos->altitude);
+ pos->latitude = ntohl(pos->latitude);
+ pos->longitude = ntohl(pos->longitude);
+ pos->altitude = ntohl(pos->altitude);
- gps_pos.sea_altitude = ntohl(pos->sea_altitude);
+ pos->sea_altitude = ntohl(pos->sea_altitude);
- gps_pos.gdop = ntohs(pos->gdop);
- gps_pos.pdop = ntohs(pos->pdop);
- gps_pos.hdop = ntohs(pos->hdop);
- gps_pos.vdop = ntohs(pos->vdop);
- gps_pos.tdop = ntohs(pos->tdop);
+ pos->gdop = ntohs(pos->gdop);
+ pos->pdop = ntohs(pos->pdop);
+ pos->hdop = ntohs(pos->hdop);
+ pos->vdop = ntohs(pos->vdop);
+ pos->tdop = ntohs(pos->tdop);
- gps_pos.ecef_vx = ntohl(pos->ecef_vx);
- gps_pos.ecef_vy = ntohl(pos->ecef_vy);
- gps_pos.ecef_vz = ntohl(pos->ecef_vz);
+ pos->ecef_vx = ntohl(pos->ecef_vx);
+ pos->ecef_vy = ntohl(pos->ecef_vy);
+ pos->ecef_vz = ntohl(pos->ecef_vz);
/* update global structure */
IRQ_LOCK(irq_flags);