3 * @brief Program to receive events from the driver/firmware of the uAP
6 * Copyright (C) 2008-2009, Marvell International Ltd.
8 * This software file (the "File") is distributed by Marvell International
9 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
10 * (the "License"). You may use, redistribute and/or modify this File in
11 * accordance with the terms and conditions of the License, a copy of which
12 * is available along with the File in the gpl.txt file or by writing to
13 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
14 * 02111-1307 or on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
16 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
18 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
19 * this warranty disclaimer.
22 /****************************************************************************
24 03/18/08: Initial creation
25 ****************************************************************************/
27 /****************************************************************************
29 ****************************************************************************/
40 #include <sys/socket.h>
41 #include <linux/netlink.h>
44 /****************************************************************************
46 ****************************************************************************/
47 /** Enable or disable debug outputs */
50 /****************************************************************************
52 ****************************************************************************/
53 /** Termination flag */
54 int terminate_flag = 0;
56 /****************************************************************************
58 ****************************************************************************/
60 * @brief Signal handler
62 * @param sig Received signal number
68 printf("Stopping application.\n");
70 printf("Process ID of process killed = %d\n", getpid());
76 * @brief Dump hex data
78 * @param p A pointer to data buffer
79 * @param len The len of data buffer
80 * @param delim Deliminator character
84 hexdump(void *p, s32 len, s8 delim)
88 for (i = 0; i < len; i++) {
90 printf("%02x%c", *s++, delim);
93 if ((i + 1) % 16 == 0)
99 * @brief Prints a MAC address in colon separated form from raw data
101 * @param raw A pointer to the hex data buffer
107 printf("%02x:%02x:%02x:%02x:%02x:%02x", (unsigned int) raw[0],
108 (unsigned int) raw[1], (unsigned int) raw[2], (unsigned int) raw[3],
109 (unsigned int) raw[4], (unsigned int) raw[5]);
114 * @brief Print usage information
122 printf("Usage : uapevent.exe [-v] [-h]\n");
123 printf(" -v : Print version information\n");
124 printf(" -h : Print help information\n");
129 * @brief Parse and print STA deauthentication event data
131 * @param buffer Pointer to received event buffer
132 * @param size Length of the received event data
136 print_event_sta_deauth(u8 * buffer, u16 size)
138 EVENTBUF_STA_DEAUTH *event_body = NULL;
140 if (size < sizeof(EVENTBUF_STA_DEAUTH)) {
141 printf("ERR:Event buffer too small!\n");
144 event_body = (EVENTBUF_STA_DEAUTH *) buffer;
145 event_body->ReasonCode = uap_le16_to_cpu(event_body->ReasonCode);
146 printf("EVENT: STA_DEAUTH\n");
147 printf("Deauthenticated STA MAC: ");
148 print_mac(event_body->StaMacAddress);
149 printf("\nReason: ");
150 switch (event_body->ReasonCode) {
152 printf("Unspecified reason.\n");
155 printf("Previous authentication no longer valid.\n");
158 printf("Deauthenticated because sending STA is leaving IBSS or ESS.\n");
161 printf("Disassociated due to inactivity.\n");
165 ("Disassociated because AP is unable to handle all currently associated STAs.\n");
168 printf("Class 2 frame received from nonauthenticated STA.\n");
171 printf("Class 3 frame received from nonassociated STA.\n");
174 printf("Disassociated because sending STA is leaving BSS.\n");
178 ("STA requesting (re)association is not authenticated with responding STA.\n");
182 ("Disassociated because the information in the Power Capability element is unacceptable.\n");
186 ("Disassociated because the information in the Supported Channels element is unacceptable.\n");
189 printf("Invalid information element.\n");
192 printf("Message integrity code (MIC) failure.\n");
195 printf("4-Way Handshake timeout.\n");
198 printf("Group Key Handshake timeout.\n");
201 printf("Information element in 4-Way Handshake different from\n");
202 printf(" (Re)Association Request/Probe Response/Beacon frame.\n");
205 printf("Invalid group cipher.\n");
208 printf("Invalid pairwise cipher.\n");
211 printf("Invalid AKMP.\n");
214 printf("Unsupported RSN information element version.\n");
217 printf("Invalid RSN information element capabilities.\n");
220 printf("IEEE 802.1X authentication failed.\n");
223 printf("Cipher suite rejected because of the security policy.\n");
226 printf("Disassociated for unspecified, QoS-related reason.\n");
230 ("Disassociated because QoS AP lacks sufficient bandwidth for this QoS STA.\n");
234 ("Disassociated because excessive number of frames need to be acknowledged\n");
236 (" but are not acknowledged due to AP transmissions and or poor channel conditions.\n");
240 ("Disassociated because STA is transmitting outside the limits of its TXOPs.\n");
244 ("Requested from peer STA as the STA is leaving the BSS or resetting.\n");
248 ("Requested from peer STA as it does not want to use the mechanism.\n");
251 printf("Requested from peer STA as the STA received frames using");
252 printf(" the mechanism for which a setup is required.\n");
255 printf("Requested from peer STA due to timeout.\n");
258 printf("Peer STA does not support the requested cipher suite.\n");
261 printf("Reserved or Unspecified\n");
268 * @brief Prints mgmt frame
270 * @param mgmt_tlv A pointer to mgmt_tlv
271 * @param tlv_len Length of tlv payload
275 print_mgmt_frame(MrvlIETypes_MgmtFrameSet_t * mgmt_tlv, int tlv_len)
277 IEEEtypes_AssocRqst_t *assoc_req = NULL;
278 IEEEtypes_ReAssocRqst_t *reassoc_req = NULL;
279 IEEEtypes_AssocRsp_t *assoc_resp = NULL;
281 printf("\nMgmt Frame:\n");
282 memcpy(&frmctl, &mgmt_tlv->FrameControl, sizeof(u16));
283 printf("FrameControl: 0x%x\n", frmctl);
284 if (mgmt_tlv->FrameControl.Type != 0) {
285 printf("Frame type=%d subtype=%d:\n", mgmt_tlv->FrameControl.Type,
286 mgmt_tlv->FrameControl.Subtype);
287 hexdump(mgmt_tlv->FrameContents, tlv_len - sizeof(u16), ' ');
290 switch (mgmt_tlv->FrameControl.Subtype) {
291 case SUBTYPE_ASSOC_REQUEST:
292 printf("Assoc Request:\n");
293 assoc_req = (IEEEtypes_AssocRqst_t *) mgmt_tlv->FrameContents;
294 printf("CapInfo: 0x%x ListenInterval: 0x%x \n",
295 uap_le16_to_cpu(assoc_req->CapInfo),
296 uap_le16_to_cpu(assoc_req->ListenInterval));
297 printf("AssocReqIE:\n");
298 hexdump(assoc_req->IEBuffer,
299 tlv_len - sizeof(IEEEtypes_AssocRqst_t) -
300 sizeof(IEEEtypes_FrameCtl_t), ' ');
302 case SUBTYPE_REASSOC_REQUEST:
303 printf("ReAssoc Request:\n");
304 reassoc_req = (IEEEtypes_ReAssocRqst_t *) mgmt_tlv->FrameContents;
305 printf("CapInfo: 0x%x ListenInterval: 0x%x \n",
306 uap_le16_to_cpu(reassoc_req->CapInfo),
307 uap_le16_to_cpu(reassoc_req->ListenInterval));
308 printf("Current AP address: ");
309 print_mac(reassoc_req->CurrentApAddr);
310 printf("\nReAssocReqIE:\n");
311 hexdump(reassoc_req->IEBuffer,
312 tlv_len - sizeof(IEEEtypes_ReAssocRqst_t) -
313 sizeof(IEEEtypes_FrameCtl_t), ' ');
315 case SUBTYPE_ASSOC_RESPONSE:
316 case SUBTYPE_REASSOC_RESPONSE:
317 if (mgmt_tlv->FrameControl.Subtype == SUBTYPE_ASSOC_RESPONSE)
318 printf("Assoc Response:\n");
320 printf("ReAssoc Response:\n");
321 assoc_resp = (IEEEtypes_AssocRsp_t *) mgmt_tlv->FrameContents;
322 printf("CapInfo: 0x%x StatusCode: %d AID: 0x%x \n",
323 uap_le16_to_cpu(assoc_resp->CapInfo),
324 (int) (uap_le16_to_cpu(assoc_resp->StatusCode)),
325 uap_le16_to_cpu(assoc_resp->AId) & 0x3fff);
328 printf("Frame subtype = %d:\n", mgmt_tlv->FrameControl.Subtype);
329 hexdump(mgmt_tlv->FrameContents, tlv_len - sizeof(u16), ' ');
336 * @brief Parse and print STA associate event data
338 * @param buffer Pointer to received buffer
339 * @param size Length of the received event data
343 print_event_sta_assoc(u8 * buffer, u16 size)
345 int tlvBufLeft = size;
347 tlvbuf_header *tlv = NULL;
348 MrvlIEtypes_WapiInfoSet_t *wapi_tlv = NULL;
349 MrvlIETypes_MgmtFrameSet_t *mgmt_tlv = NULL;
350 EVENTBUF_STA_ASSOC *event_body = NULL;
351 if (size < sizeof(EVENTBUF_STA_ASSOC)) {
352 printf("ERR:Event buffer too small!\n");
355 event_body = (EVENTBUF_STA_ASSOC *) buffer;
356 printf("EVENT: STA_ASSOCIATE\n");
357 printf("Associated STA MAC: ");
358 print_mac(event_body->StaMacAddress);
360 tlvBufLeft = size - sizeof(EVENTBUF_STA_ASSOC);
361 if (tlvBufLeft < (int) sizeof(tlvbuf_header))
363 tlv = (tlvbuf_header *) (buffer + sizeof(EVENTBUF_STA_ASSOC));
365 while (tlvBufLeft >= (int) sizeof(tlvbuf_header)) {
366 tlvType = uap_le16_to_cpu(tlv->type);
367 tlvLen = uap_le16_to_cpu(tlv->len);
368 if ((sizeof(tlvbuf_header) + tlvLen) > tlvBufLeft) {
369 printf("wrong tlv: tlvLen=%d, tlvBufLeft=%d\n", tlvLen, tlvBufLeft);
373 case MRVL_WAPI_INFO_TLV_ID:
374 wapi_tlv = (MrvlIEtypes_WapiInfoSet_t *) tlv;
375 printf("WAPI Multicast PN:\n");
376 hexdump(wapi_tlv->MulticastPN, tlvLen, ' ');
378 case MRVL_MGMT_FRAME_TLV_ID:
379 mgmt_tlv = (MrvlIETypes_MgmtFrameSet_t *) tlv;
380 print_mgmt_frame(mgmt_tlv, tlvLen);
383 printf("unknown tlv: %d\n", tlvType);
386 tlvBufLeft -= (sizeof(tlvbuf_header) + tlvLen);
387 tlv = (tlvbuf_header *) ((u8 *) tlv + tlvLen + sizeof(tlvbuf_header));
393 * @brief Parse and print BSS start event data
395 * @param buffer Pointer to received buffer
396 * @param size Length of the received event data
400 print_event_bss_start(u8 * buffer, u16 size)
402 EVENTBUF_BSS_START *event_body = NULL;
404 if (size < sizeof(EVENTBUF_BSS_START)) {
405 printf("ERR:Event buffer too small!\n");
408 event_body = (EVENTBUF_BSS_START *) buffer;
409 printf("EVENT: BSS_START ");
411 print_mac(event_body->apMacAddress);
417 * @brief Prints station reject state
419 * @param state fail state
423 print_reject_state(u8 state)
426 case REJECT_STATE_FAIL_EAPOL_2:
427 printf("Reject state: FAIL_EAPOL_2\n");
429 case REJECT_STATE_FAIL_EAPOL_4:
430 printf("Reject state: FAIL_EAPOL_4:\n");
432 case REJECT_STATE_FAIL_EAPOL_GROUP_2:
433 printf("Reject state: FAIL_EAPOL_GROUP_2\n");
436 printf("ERR: unknown reject state %d\n", state);
443 * @brief Prints station reject reason
445 * @param reason reason code
449 print_reject_reason(u16 reason)
452 case IEEEtypes_REASON_INVALID_IE:
453 printf("Reject reason: Invalid IE\n");
455 case IEEEtypes_REASON_MIC_FAILURE:
456 printf("Reject reason: Mic Failure\n");
459 printf("Reject reason: %d\n", reason);
466 * @brief Prints EAPOL state
468 * @param state eapol state
472 print_eapol_state(u8 state)
476 printf("Eapol state: EAPOL_START\n");
478 case EAPOL_WAIT_PWK2:
479 printf("Eapol state: EAPOL_WAIT_PWK2\n");
481 case EAPOL_WAIT_PWK4:
482 printf("Eapol state: EAPOL_WAIT_PWK4\n");
484 case EAPOL_WAIT_GTK2:
485 printf("Eapol state: EAPOL_WAIT_GTK2\n");
488 printf("Eapol state: EAPOL_END\n");
491 printf("ERR: unknow eapol state%d\n", state);
498 * @brief Parse and print debug event data
500 * @param buffer Pointer to received buffer
501 * @param size Length of the received event data
505 print_event_debug(u8 * buffer, u16 size)
507 EVENTBUF_DEBUG *event_body = NULL;
508 if (size < sizeof(EVENTBUF_DEBUG)) {
509 printf("ERR:Event buffer too small!\n");
512 event_body = (EVENTBUF_DEBUG *) buffer;
513 printf("Debug Event Type: %s\n",
514 (event_body->debugtype == 0) ? "EVENT" : "INFO");
516 (uap_le32_to_cpu(event_body->debugIdMajor) ==
517 DEBUG_ID_MAJ_AUTHENTICATOR) ? "Authenticator" : "Assoc_agent");
518 if (uap_le32_to_cpu(event_body->debugIdMajor) == DEBUG_ID_MAJ_AUTHENTICATOR) {
519 switch (uap_le32_to_cpu(event_body->debugIdMinor)) {
520 case DEBUG_MAJ_AUTH_MIN_PWK1:
521 printf("EAPOL Key message 1 (PWK):\n");
522 hexdump((u8 *) & event_body->info.eapol_pwkMsg,
523 sizeof(EAPOL_KeyMsg_Debug_t), ' ');
525 case DEBUG_MAJ_AUTH_MIN_PWK2:
526 printf("EAPOL Key message 2 (PWK):\n");
527 hexdump((u8 *) & event_body->info.eapol_pwkMsg,
528 sizeof(EAPOL_KeyMsg_Debug_t), ' ');
530 case DEBUG_MAJ_AUTH_MIN_PWK3:
531 printf("EAPOL Key message 3 (PWK):\n");
532 hexdump((u8 *) & event_body->info.eapol_pwkMsg,
533 sizeof(EAPOL_KeyMsg_Debug_t), ' ');
535 case DEBUG_MAJ_AUTH_MIN_PWK4:
536 printf("EAPOL Key message 4: (PWK)\n");
537 hexdump((u8 *) & event_body->info.eapol_pwkMsg,
538 sizeof(EAPOL_KeyMsg_Debug_t), ' ');
540 case DEBUG_MAJ_AUTH_MIN_GWK1:
541 printf("EAPOL Key message 1: (GWK)\n");
542 hexdump((u8 *) & event_body->info.eapol_pwkMsg,
543 sizeof(EAPOL_KeyMsg_Debug_t), ' ');
545 case DEBUG_MAJ_AUTH_MIN_GWK2:
546 printf("EAPOL Key message 2: (GWK)\n");
547 hexdump((u8 *) & event_body->info.eapol_pwkMsg,
548 sizeof(EAPOL_KeyMsg_Debug_t), ' ');
550 case DEBUG_MAJ_AUTH_MIN_STA_REJ:
551 printf("Reject STA MAC: ");
552 print_mac(event_body->info.sta_reject.staMacAddr);
554 print_reject_state(event_body->info.sta_reject.reject_state);
555 print_reject_reason(uap_le16_to_cpu
556 (event_body->info.sta_reject.reject_reason));
558 case DEBUG_MAJ_AUTH_MIN_EAPOL_TR:
560 print_mac(event_body->info.eapol_state.staMacAddr);
562 print_eapol_state(event_body->info.eapol_state.eapolState);
565 printf("ERR: unknow debugIdMinor: %d\n",
566 (int) uap_le32_to_cpu(event_body->debugIdMinor));
567 hexdump(buffer, size, ' ');
570 } else if (uap_le32_to_cpu(event_body->debugIdMajor) ==
571 DEBUG_ID_MAJ_ASSOC_AGENT) {
572 switch (uap_le32_to_cpu(event_body->debugIdMinor)) {
573 case DEBUG_ID_MAJ_ASSOC_MIN_WPA_IE:
575 print_mac(event_body->info.wpaIe.staMacAddr);
578 hexdump(event_body->info.wpaIe.wpa_ie, MAX_WPA_IE_LEN, ' ');
580 case DEBUG_ID_MAJ_ASSOC_MIN_STA_REJ:
581 printf("Reject STA MAC: ");
582 print_mac(event_body->info.sta_reject.staMacAddr);
584 print_reject_state(event_body->info.sta_reject.reject_state);
585 print_reject_reason(uap_le16_to_cpu
586 (event_body->info.sta_reject.reject_reason));
589 printf("ERR: unknow debugIdMinor: %d\n",
590 (int) uap_le32_to_cpu(event_body->debugIdMinor));
591 hexdump(buffer, size, ' ');
599 * @brief Parse and print received event information
601 * @param event Pointer to received event
602 * @param size Length of the received event
606 print_event(EVENTHEADER * event, u16 size)
608 u32 event_id = event->EventId & EVENT_ID_MASK;
610 case MICRO_AP_EV_ID_STA_DEAUTH:
611 print_event_sta_deauth(event->EventData, size - EVENT_ID_LEN);
613 case MICRO_AP_EV_ID_STA_ASSOC:
614 print_event_sta_assoc(event->EventData, size - EVENT_ID_LEN);
616 case MICRO_AP_EV_ID_BSS_START:
617 print_event_bss_start(event->EventData, size - EVENT_ID_LEN);
619 case MICRO_AP_EV_ID_DEBUG:
620 print_event_debug(event->EventData, size - EVENT_ID_LEN);
622 case MICRO_AP_EV_BSS_IDLE:
623 printf("EVENT: BSS_IDLE\n");
625 case MICRO_AP_EV_BSS_ACTIVE:
626 printf("EVENT: BSS_ACTIVE\n");
629 printf("ERR:Undefined event type (%X). Dumping event buffer:\n",
630 (unsigned int) event_id);
631 hexdump((void *) event, size, ' ');
638 * @brief Read event data from netlink socket
640 * @param sk_fd Netlink socket handler
641 * @param buffer Pointer to the data buffer
642 * @param nlh Pointer to netlink message header
643 * @param msg Pointer to message header
644 * @return Number of bytes read or UAP_FAILURE
647 read_event_netlink_socket(int sk_fd, unsigned char *buffer,
648 struct nlmsghdr *nlh, struct msghdr *msg)
651 count = recvmsg(sk_fd, msg, 0);
653 printf("DBG:Waiting for message from NETLINK.\n");
656 printf("ERR:NETLINK read failed!\n");
661 printf("DBG:Received message payload (%d)\n", count);
663 if (count > NLMSG_SPACE(NL_MAX_PAYLOAD)) {
664 printf("ERR:Buffer overflow!\n");
667 bzero(buffer, NL_MAX_PAYLOAD);
668 memcpy(buffer, NLMSG_DATA(nlh), count - NLMSG_HDRLEN);
670 hexdump(buffer, count - NLMSG_HDRLEN, ' ');
672 return count - NLMSG_HDRLEN;
676 * @brief Configure and read event data from netlink socket
678 * @param sk_fd Netlink socket handler
679 * @param buffer Pointer to the data buffer
680 * @param timeout Socket listen timeout value
681 * @param nlh Pointer to netlink message header
682 * @param msg Pointer to message header
683 * @return Number of bytes read or UAP_FAILURE
686 read_event(int sk_fd, unsigned char *buffer, int timeout, struct nlmsghdr *nlh,
691 int ret = UAP_FAILURE;
695 FD_SET(sk_fd, &rfds);
697 /* Initialize timeout value */
701 tv.tv_sec = UAP_RECV_WAIT_DEFAULT;
705 ret = select(sk_fd + 1, &rfds, NULL, NULL, &tv);
711 /* Timeout. Try again */
714 if (!FD_ISSET(sk_fd, &rfds)) {
715 /* Unexpected error. Try again */
720 ret = read_event_netlink_socket(sk_fd, buffer, nlh, msg);
724 /* Command line options */
725 static const struct option long_opts[] = {
726 {"help", no_argument, NULL, 'h'},
727 {"version", no_argument, NULL, 'v'},
731 /****************************************************************************
733 ****************************************************************************/
735 * @brief The main function
737 * @param argc Number of arguments
738 * @param argv Pointer to the arguments
742 main(int argc, char *argv[])
746 struct nlmsghdr *nlh = NULL;
747 struct sockaddr_nl src_addr, dest_addr;
750 unsigned char *buffer = NULL;
751 struct timeval current_time;
754 EVENTHEADER *event = NULL;
755 int ret = UAP_FAILURE;
757 /* Check command line options */
758 while ((opt = getopt_long(argc, argv, "hvt", long_opts, NULL)) > 0) {
764 printf("uapevent version : %s\n", UAP_VERSION);
773 fputs("Too many arguments.\n", stderr);
778 /* Open netlink socket */
779 nl_sk = socket(PF_NETLINK, SOCK_RAW, NETLINK_MARVELL);
781 printf("ERR:Could not open netlink socket.\n");
786 /* Set source address */
787 bzero((char *) &src_addr, sizeof(src_addr));
788 src_addr.nl_family = AF_NETLINK;
789 src_addr.nl_pid = getpid(); /* Our PID */
790 src_addr.nl_groups = NL_MULTICAST_GROUP;
792 /* Bind socket with source address */
793 if (bind(nl_sk, (struct sockaddr *) &src_addr, sizeof(src_addr)) < 0) {
794 printf("ERR:Could not bind socket!\n");
799 /* Set destination address */
800 memset(&dest_addr, 0, sizeof(dest_addr));
801 dest_addr.nl_family = AF_NETLINK;
802 dest_addr.nl_pid = 0; /* Kernel */
803 dest_addr.nl_groups = NL_MULTICAST_GROUP;
805 /* Initialize netlink header */
806 nlh = (struct nlmsghdr *) malloc(NLMSG_SPACE(NL_MAX_PAYLOAD));
808 printf("ERR: Could not alloc buffer\n");
812 memset(nlh, 0, NLMSG_SPACE(NL_MAX_PAYLOAD));
814 /* Initialize I/O vector */
815 iov.iov_base = (void *) nlh;
816 iov.iov_len = NLMSG_SPACE(NL_MAX_PAYLOAD);
818 /* Initialize message header */
819 memset(&msg, 0, sizeof(struct msghdr));
820 msg.msg_name = (void *) &dest_addr;
821 msg.msg_namelen = sizeof(dest_addr);
825 /* Initialize receive buffer */
826 buffer = malloc(NL_MAX_PAYLOAD);
828 printf("ERR: Could not alloc buffer\n");
832 bzero(buffer, sizeof(buffer));
834 gettimeofday(¤t_time, NULL);
837 printf("*********************************************\n");
838 if ((timeinfo = localtime(&(current_time.tv_sec))))
839 printf("uapevent start time : %s", asctime(timeinfo));
840 printf(" %u usecs\n",
841 (unsigned int) current_time.tv_usec);
842 printf("*********************************************\n");
844 signal(SIGTERM, sig_handler);
845 signal(SIGINT, sig_handler);
846 signal(SIGALRM, sig_handler);
848 if (terminate_flag) {
849 printf("Stopping!\n");
852 ret = read_event(nl_sk, buffer, 0, nlh, &msg);
854 /* No result. Loop again */
855 if (ret == UAP_FAILURE) {
859 /* Zero bytes received */
860 printf("ERR:Received zero bytes!\n");
864 gettimeofday(¤t_time, NULL);
866 printf("============================================\n");
867 printf("Received event");
868 if ((timeinfo = localtime(&(current_time.tv_sec))))
869 printf(": %s", asctime(timeinfo));
870 printf(" %u usecs\n",
871 (unsigned int) current_time.tv_usec);
872 printf("============================================\n");
873 event = (EVENTHEADER *) buffer;
874 event->EventId = uap_le32_to_cpu(event->EventId);
876 printf("DBG:Received buffer =\n");
877 hexdump(buffer, ret, ' ');
879 print_event(event, ret);
882 gettimeofday(¤t_time, NULL);
884 printf("********************************************\n");
885 if ((timeinfo = localtime(&(current_time.tv_sec))))
886 printf("uapevent end time : %s", asctime(timeinfo));
887 printf(" %u usecs\n",
888 (unsigned int) current_time.tv_usec);
889 printf("Total events : %u\n", num_events);
890 printf("********************************************\n");