import struct


def unpack(msg):
    """
    Unpack a garmin device communication packet.
    uint16_t=pid, uint16_t=length, data[]
    """
    pid, length = struct.unpack("<HH", msg[:4])
    data = msg[4:4 + length]
    return pid, length, data