aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/ev-layer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/gigaset/ev-layer.c')
-rw-r--r--drivers/isdn/gigaset/ev-layer.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index ddeb0456d202..c8f89b78b233 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -427,7 +427,7 @@ static int isdn_getnum(char *p)
427{ 427{
428 int v = -1; 428 int v = -1;
429 429
430 gig_dbg(DEBUG_TRANSCMD, "string: %s", p); 430 gig_dbg(DEBUG_EVENT, "string: %s", p);
431 431
432 while (*p >= '0' && *p <= '9') 432 while (*p >= '0' && *p <= '9')
433 v = ((v < 0) ? 0 : (v * 10)) + (int) ((*p++) - '0'); 433 v = ((v < 0) ? 0 : (v * 10)) + (int) ((*p++) - '0');
@@ -444,7 +444,7 @@ static int isdn_gethex(char *p)
444 int v = 0; 444 int v = 0;
445 int c; 445 int c;
446 446
447 gig_dbg(DEBUG_TRANSCMD, "string: %s", p); 447 gig_dbg(DEBUG_EVENT, "string: %s", p);
448 448
449 if (!*p) 449 if (!*p)
450 return -1; 450 return -1;
@@ -517,7 +517,6 @@ void gigaset_handle_modem_response(struct cardstate *cs)
517 return; 517 return;
518 } 518 }
519 cs->respdata[len] = 0; 519 cs->respdata[len] = 0;
520 gig_dbg(DEBUG_TRANSCMD, "raw string: '%s'", cs->respdata);
521 argv[0] = cs->respdata; 520 argv[0] = cs->respdata;
522 params = 1; 521 params = 1;
523 if (cs->at_state.getstring) { 522 if (cs->at_state.getstring) {
@@ -552,14 +551,14 @@ void gigaset_handle_modem_response(struct cardstate *cs)
552 for (j = 1; j < params; ++j) 551 for (j = 1; j < params; ++j)
553 argv[j][-1] = 0; 552 argv[j][-1] = 0;
554 553
555 gig_dbg(DEBUG_TRANSCMD, "CMD received: %s", argv[0]); 554 gig_dbg(DEBUG_EVENT, "CMD received: %s", argv[0]);
556 if (cid) { 555 if (cid) {
557 --params; 556 --params;
558 gig_dbg(DEBUG_TRANSCMD, "CID: %s", argv[params]); 557 gig_dbg(DEBUG_EVENT, "CID: %s", argv[params]);
559 } 558 }
560 gig_dbg(DEBUG_TRANSCMD, "available params: %d", params - 1); 559 gig_dbg(DEBUG_EVENT, "available params: %d", params - 1);
561 for (j = 1; j < params; j++) 560 for (j = 1; j < params; j++)
562 gig_dbg(DEBUG_TRANSCMD, "param %d: %s", j, argv[j]); 561 gig_dbg(DEBUG_EVENT, "param %d: %s", j, argv[j]);
563 } 562 }
564 563
565 spin_lock_irqsave(&cs->ev_lock, flags); 564 spin_lock_irqsave(&cs->ev_lock, flags);
@@ -642,7 +641,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
642 dev_err(cs->dev, "out of memory\n"); 641 dev_err(cs->dev, "out of memory\n");
643 ++curarg; 642 ++curarg;
644 } 643 }
645 gig_dbg(DEBUG_CMD, "string==%s", 644 gig_dbg(DEBUG_EVENT, "string==%s",
646 event->ptr ? (char *) event->ptr : "NULL"); 645 event->ptr ? (char *) event->ptr : "NULL");
647 break; 646 break;
648 case RT_ZCAU: 647 case RT_ZCAU:
@@ -669,7 +668,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
669 ++curarg; 668 ++curarg;
670 } else 669 } else
671 event->parameter = -1; 670 event->parameter = -1;
672 gig_dbg(DEBUG_CMD, "parameter==%d", event->parameter); 671 gig_dbg(DEBUG_EVENT, "parameter==%d", event->parameter);
673 break; 672 break;
674 } 673 }
675 674
@@ -684,7 +683,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
684 spin_unlock_irqrestore(&cs->ev_lock, flags); 683 spin_unlock_irqrestore(&cs->ev_lock, flags);
685 684
686 if (curarg != params) 685 if (curarg != params)
687 gig_dbg(DEBUG_ANY, 686 gig_dbg(DEBUG_EVENT,
688 "invalid number of processed parameters: %d/%d", 687 "invalid number of processed parameters: %d/%d",
689 curarg, params); 688 curarg, params);
690} 689}
@@ -705,8 +704,8 @@ static void disconnect(struct at_state_t **at_state_p)
705 /* revert to selected idle mode */ 704 /* revert to selected idle mode */
706 if (!cs->cidmode) { 705 if (!cs->cidmode) {
707 cs->at_state.pending_commands |= PC_UMMODE; 706 cs->at_state.pending_commands |= PC_UMMODE;
707 gig_dbg(DEBUG_EVENT, "Scheduling PC_UMMODE");
708 cs->commands_pending = 1; 708 cs->commands_pending = 1;
709 gig_dbg(DEBUG_CMD, "Scheduling PC_UMMODE");
710 } 709 }
711 spin_unlock_irqrestore(&cs->lock, flags); 710 spin_unlock_irqrestore(&cs->lock, flags);
712 711
@@ -784,15 +783,15 @@ static void init_failed(struct cardstate *cs, int mode)
784static void schedule_init(struct cardstate *cs, int state) 783static void schedule_init(struct cardstate *cs, int state)
785{ 784{
786 if (cs->at_state.pending_commands & PC_INIT) { 785 if (cs->at_state.pending_commands & PC_INIT) {
787 gig_dbg(DEBUG_CMD, "not scheduling PC_INIT again"); 786 gig_dbg(DEBUG_EVENT, "not scheduling PC_INIT again");
788 return; 787 return;
789 } 788 }
790 cs->mstate = state; 789 cs->mstate = state;
791 cs->mode = M_UNKNOWN; 790 cs->mode = M_UNKNOWN;
792 gigaset_block_channels(cs); 791 gigaset_block_channels(cs);
793 cs->at_state.pending_commands |= PC_INIT; 792 cs->at_state.pending_commands |= PC_INIT;
793 gig_dbg(DEBUG_EVENT, "Scheduling PC_INIT");
794 cs->commands_pending = 1; 794 cs->commands_pending = 1;
795 gig_dbg(DEBUG_CMD, "Scheduling PC_INIT");
796} 795}
797 796
798/* Add "AT" to a command, add the cid, dle encode it, send the result to the 797/* Add "AT" to a command, add the cid, dle encode it, send the result to the
@@ -923,7 +922,7 @@ static void start_dial(struct at_state_t *at_state, void *data,
923 } 922 }
924 923
925 at_state->pending_commands |= PC_CID; 924 at_state->pending_commands |= PC_CID;
926 gig_dbg(DEBUG_CMD, "Scheduling PC_CID"); 925 gig_dbg(DEBUG_EVENT, "Scheduling PC_CID");
927 cs->commands_pending = 1; 926 cs->commands_pending = 1;
928 return; 927 return;
929 928
@@ -933,7 +932,7 @@ error:
933 commands[i] = NULL; 932 commands[i] = NULL;
934 } 933 }
935 at_state->pending_commands |= PC_NOCID; 934 at_state->pending_commands |= PC_NOCID;
936 gig_dbg(DEBUG_CMD, "Scheduling PC_NOCID"); 935 gig_dbg(DEBUG_EVENT, "Scheduling PC_NOCID");
937 cs->commands_pending = 1; 936 cs->commands_pending = 1;
938 return; 937 return;
939} 938}
@@ -955,7 +954,7 @@ static void start_accept(struct at_state_t *at_state)
955 dev_err(at_state->cs->dev, "out of memory\n"); 954 dev_err(at_state->cs->dev, "out of memory\n");
956 /* error reset */ 955 /* error reset */
957 at_state->pending_commands |= PC_HUP; 956 at_state->pending_commands |= PC_HUP;
958 gig_dbg(DEBUG_CMD, "Scheduling PC_HUP"); 957 gig_dbg(DEBUG_EVENT, "Scheduling PC_HUP");
959 cs->commands_pending = 1; 958 cs->commands_pending = 1;
960 return; 959 return;
961 } 960 }
@@ -964,7 +963,7 @@ static void start_accept(struct at_state_t *at_state)
964 snprintf(bcs->commands[AT_ISO], 9, "^SISO=%u\r", bcs->channel + 1); 963 snprintf(bcs->commands[AT_ISO], 9, "^SISO=%u\r", bcs->channel + 1);
965 964
966 at_state->pending_commands |= PC_ACCEPT; 965 at_state->pending_commands |= PC_ACCEPT;
967 gig_dbg(DEBUG_CMD, "Scheduling PC_ACCEPT"); 966 gig_dbg(DEBUG_EVENT, "Scheduling PC_ACCEPT");
968 cs->commands_pending = 1; 967 cs->commands_pending = 1;
969} 968}
970 969
@@ -1009,8 +1008,8 @@ static void do_shutdown(struct cardstate *cs)
1009 if (cs->mstate == MS_READY) { 1008 if (cs->mstate == MS_READY) {
1010 cs->mstate = MS_SHUTDOWN; 1009 cs->mstate = MS_SHUTDOWN;
1011 cs->at_state.pending_commands |= PC_SHUTDOWN; 1010 cs->at_state.pending_commands |= PC_SHUTDOWN;
1011 gig_dbg(DEBUG_EVENT, "Scheduling PC_SHUTDOWN");
1012 cs->commands_pending = 1; 1012 cs->commands_pending = 1;
1013 gig_dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN");
1014 } else 1013 } else
1015 finish_shutdown(cs); 1014 finish_shutdown(cs);
1016} 1015}
@@ -1191,8 +1190,8 @@ static void do_action(int action, struct cardstate *cs,
1191 } 1190 }
1192 spin_unlock_irqrestore(&cs->lock, flags); 1191 spin_unlock_irqrestore(&cs->lock, flags);
1193 cs->at_state.pending_commands |= PC_CIDMODE; 1192 cs->at_state.pending_commands |= PC_CIDMODE;
1193 gig_dbg(DEBUG_EVENT, "Scheduling PC_CIDMODE");
1194 cs->commands_pending = 1; 1194 cs->commands_pending = 1;
1195 gig_dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
1196 break; 1195 break;
1197 case ACT_FAILINIT: 1196 case ACT_FAILINIT:
1198 dev_warn(cs->dev, "Could not initialize the device.\n"); 1197 dev_warn(cs->dev, "Could not initialize the device.\n");
@@ -1443,7 +1442,7 @@ static void do_action(int action, struct cardstate *cs,
1443 case ACT_GOTVER: 1442 case ACT_GOTVER:
1444 if (cs->gotfwver == 0) { 1443 if (cs->gotfwver == 0) {
1445 cs->gotfwver = 1; 1444 cs->gotfwver = 1;
1446 gig_dbg(DEBUG_ANY, 1445 gig_dbg(DEBUG_EVENT,
1447 "firmware version %02d.%03d.%02d.%02d", 1446 "firmware version %02d.%03d.%02d.%02d",
1448 cs->fwver[0], cs->fwver[1], 1447 cs->fwver[0], cs->fwver[1],
1449 cs->fwver[2], cs->fwver[3]); 1448 cs->fwver[2], cs->fwver[3]);
@@ -1481,8 +1480,8 @@ static void do_action(int action, struct cardstate *cs,
1481 break; 1480 break;
1482 case ACT_HUP: 1481 case ACT_HUP:
1483 at_state->pending_commands |= PC_HUP; 1482 at_state->pending_commands |= PC_HUP;
1483 gig_dbg(DEBUG_EVENT, "Scheduling PC_HUP");
1484 cs->commands_pending = 1; 1484 cs->commands_pending = 1;
1485 gig_dbg(DEBUG_CMD, "Scheduling PC_HUP");
1486 break; 1485 break;
1487 1486
1488 /* hotplug events */ 1487 /* hotplug events */
@@ -1519,10 +1518,10 @@ static void do_action(int action, struct cardstate *cs,
1519 cs->cidmode = ev->parameter; 1518 cs->cidmode = ev->parameter;
1520 if (ev->parameter) { 1519 if (ev->parameter) {
1521 cs->at_state.pending_commands |= PC_CIDMODE; 1520 cs->at_state.pending_commands |= PC_CIDMODE;
1522 gig_dbg(DEBUG_CMD, "Scheduling PC_CIDMODE"); 1521 gig_dbg(DEBUG_EVENT, "Scheduling PC_CIDMODE");
1523 } else { 1522 } else {
1524 cs->at_state.pending_commands |= PC_UMMODE; 1523 cs->at_state.pending_commands |= PC_UMMODE;
1525 gig_dbg(DEBUG_CMD, "Scheduling PC_UMMODE"); 1524 gig_dbg(DEBUG_EVENT, "Scheduling PC_UMMODE");
1526 } 1525 }
1527 cs->commands_pending = 1; 1526 cs->commands_pending = 1;
1528 } 1527 }
@@ -1573,6 +1572,8 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1573 if (ev->cid >= 0) { 1572 if (ev->cid >= 0) {
1574 at_state = at_state_from_cid(cs, ev->cid); 1573 at_state = at_state_from_cid(cs, ev->cid);
1575 if (!at_state) { 1574 if (!at_state) {
1575 gig_dbg(DEBUG_EVENT, "event %d for invalid cid %d",
1576 ev->type, ev->cid);
1576 gigaset_add_event(cs, &cs->at_state, RSP_WRONG_CID, 1577 gigaset_add_event(cs, &cs->at_state, RSP_WRONG_CID,
1577 NULL, 0, NULL); 1578 NULL, 0, NULL);
1578 return; 1579 return;
@@ -1580,13 +1581,13 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1580 } else { 1581 } else {
1581 at_state = ev->at_state; 1582 at_state = ev->at_state;
1582 if (at_state_invalid(cs, at_state)) { 1583 if (at_state_invalid(cs, at_state)) {
1583 gig_dbg(DEBUG_ANY, "event for invalid at_state %p", 1584 gig_dbg(DEBUG_EVENT, "event for invalid at_state %p",
1584 at_state); 1585 at_state);
1585 return; 1586 return;
1586 } 1587 }
1587 } 1588 }
1588 1589
1589 gig_dbg(DEBUG_CMD, "connection state %d, event %d", 1590 gig_dbg(DEBUG_EVENT, "connection state %d, event %d",
1590 at_state->ConState, ev->type); 1591 at_state->ConState, ev->type);
1591 1592
1592 bcs = at_state->bcs; 1593 bcs = at_state->bcs;
@@ -1600,11 +1601,11 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1600 if (ev->parameter != at_state->timer_index 1601 if (ev->parameter != at_state->timer_index
1601 || !at_state->timer_active) { 1602 || !at_state->timer_active) {
1602 ev->type = RSP_NONE; /* old timeout */ 1603 ev->type = RSP_NONE; /* old timeout */
1603 gig_dbg(DEBUG_ANY, "old timeout"); 1604 gig_dbg(DEBUG_EVENT, "old timeout");
1604 } else if (!at_state->waiting) 1605 } else if (!at_state->waiting)
1605 gig_dbg(DEBUG_ANY, "timeout occurred"); 1606 gig_dbg(DEBUG_EVENT, "timeout occurred");
1606 else 1607 else
1607 gig_dbg(DEBUG_ANY, "stopped waiting"); 1608 gig_dbg(DEBUG_EVENT, "stopped waiting");
1608 } 1609 }
1609 spin_unlock_irqrestore(&cs->lock, flags); 1610 spin_unlock_irqrestore(&cs->lock, flags);
1610 1611
@@ -1712,11 +1713,11 @@ static void process_command_flags(struct cardstate *cs)
1712 cs->commands_pending = 0; 1713 cs->commands_pending = 0;
1713 1714
1714 if (cs->cur_at_seq) { 1715 if (cs->cur_at_seq) {
1715 gig_dbg(DEBUG_CMD, "not searching scheduled commands: busy"); 1716 gig_dbg(DEBUG_EVENT, "not searching scheduled commands: busy");
1716 return; 1717 return;
1717 } 1718 }
1718 1719
1719 gig_dbg(DEBUG_CMD, "searching scheduled commands"); 1720 gig_dbg(DEBUG_EVENT, "searching scheduled commands");
1720 1721
1721 sequence = SEQ_NONE; 1722 sequence = SEQ_NONE;
1722 1723
@@ -1857,7 +1858,7 @@ static void process_command_flags(struct cardstate *cs)
1857 switch (cs->mode) { 1858 switch (cs->mode) {
1858 case M_UNIMODEM: 1859 case M_UNIMODEM:
1859 cs->at_state.pending_commands |= PC_CIDMODE; 1860 cs->at_state.pending_commands |= PC_CIDMODE;
1860 gig_dbg(DEBUG_CMD, "Scheduling PC_CIDMODE"); 1861 gig_dbg(DEBUG_EVENT, "Scheduling PC_CIDMODE");
1861 cs->commands_pending = 1; 1862 cs->commands_pending = 1;
1862 return; 1863 return;
1863#ifdef GIG_MAYINITONDIAL 1864#ifdef GIG_MAYINITONDIAL