anchor.diff:              {ignore, Frame}
       end;
   ingest_data_frame(MAC, MType, _Msg, _FOpts, _FRMPayload, _MIC, #frame{devaddr=DevAddr}) ->
  -    lager:debug("~s ~s downlink frame (mtype ~.2B)", [binary_to_hex(MAC), binary_to_hex(DevAddr), MType]),
  +    lager:warning("~s ~s downlink frame (mtype ~.2B)", [binary_to_hex(MAC), binary_to_hex(DevAddr), MType]),
       ignore.
   
  -handle_join(#device{deveui=DevEUI, profile=ProfID}=Device, DevNonce) ->
  +handle_join(MAC, #device{deveui=DevEUI, profile=ProfID}=Device, DevNonce) ->
       case mnesia:read(profile, ProfID, read) of
           [] ->
               {error, {device, DevEUI}, {unknown_profile, ProfID}, aggregated};
  
positive.code:             end),
      Res;
  ingest_frame(MAC, PHYPayload) ->
      lager:debug("~s unknown frame protocol: ~p", [binary_to_hex(MAC), PHYPayload]),
      ignore.
  
  ingest_frame0(_MAC, 2#000, <<_, AppEUI0:8/binary, DevEUI0:8/binary,
          DevNonce:2/binary>> = Msg, MIC) ->
      {AppEUI, DevEUI} = {reverse(AppEUI0), reverse(DevEUI0)},
      case mnesia:read(device, DevEUI, read) of
  
negative.code:         [D] ->
              case aes_cmac:aes_cmac(D#device.appkey, Msg, 4) of
                  MIC ->
                      handle_join(MAC, D, DevNonce);
                  _MIC2 ->
                      {error, {device, DevEUI}, bad_mic}
              end
  