-
-
Notifications
You must be signed in to change notification settings - Fork 99
Open
Description
Change sequence number on "No response"
Description
If CP doesn't receive answer from PD in 200ms, CP needs to resend packet with old (non-increased) sequence number. (As I know)
Now sequence number always increased, so:
- CP once doesn't received answer
- CP resend command with next sequence nubmer
- PD (that doesn't get packet at first time) see in this packet erroneous sequence number
- PD answer osdp_NAK for this packet
- CP see osdp_NAK and close connection
I changed in osdp_phy.c function phy_get_next_seq_number() to this:
static inline int phy_get_next_seq_number(struct osdp_pd *pd)
{
if (pd->phy_retry_count != 0) { /* Resend packet with old seq num */
return pd->seq_number;
}
int next_seq = pd->seq_number;
next_seq += 1;
if (next_seq > 3) {
next_seq = 1;
}
return next_seq;
}This solution help me to do connection with card reader.
Is it wrong solution or bug-fix?
Logs pf communication
osdp::cp: 2000-01-01T01:24:59Z osdp_cp.c:1463 [INFO ] CP Setup complete; LibOSDP-3.0.8 NumPDs:1 Channels:1
src/rs485.c:cp_send:639 Sended 10 bytes: [ FF 53 01 09 00 04 61 00 60 23 ]
src/rs485.c:cp_recv:670 Received 20 bytes: [ 53 81 14 00 04 45 18 68 CB 00 00 68 44 96 B7 02 01 00 F4 0C ]
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:682 [DEBUG] CMD: ID(61) REPLY: PDID(45)
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:1226 [DEBUG] StateChange: [ID-Request] -> [Cap-Detect] (SC-Inactive)
src/rs485.c:cp_send:639 Sended 10 bytes: [ FF 53 01 09 00 05 62 00 03 41 ]
src/rs485.c:cp_recv:670 Received 26 bytes: [ 53 81 1A 00 05 46 01 04 01 03 03 03 04 04 03 05 02 02 08 01 01 0A 80 00 24 F2 ]
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:459 [DEBUG] Reports capability 'ContactStatusMonitoring' (4/1)
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:459 [DEBUG] Reports capability 'CardDataFormat' (3/3)
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:459 [DEBUG] Reports capability 'LEDControl' (4/3)
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:459 [DEBUG] Reports capability 'AudibleControl' (2/2)
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:459 [DEBUG] Reports capability 'CheckCharacter' (1/1)
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:459 [DEBUG] Reports capability 'ReceiveBufferSize' (128/0)
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:682 [DEBUG] CMD: CAP(62) REPLY: PDCAP(46)
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:1202 [INFO ] Online; Without SC
OSDP: CP: PD-1: 2000-01-01T01:24:59Z osdp_cp.c:1226 [DEBUG] StateChange: [Cap-Detect] -> [Online] (SC-Inactive)
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 06 60 D8 66 ]
src/rs485.c:cp_recv:670 Received 10 bytes: [ 53 81 0A 00 06 48 01 00 16 D7 ]
RS-485: OSDP: func: cp_event_callback : [
osdp event type: OSDP_EVENT_STATUS;
osdp_status_report:
osdp_status_report_type: OSDP_STATUS_REPORT_LOCAL nr_entries: 2 mask: 1
] end of debug data
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 07 60 E9 55 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 07 40 5B 53 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 05 60 8B 33 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 05 40 39 35 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 06 60 D8 66 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 06 40 6A 60 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 07 60 E9 55 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 07 40 5B 53 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 05 60 8B 33 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 05 40 39 35 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 06 60 D8 66 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 06 40 6A 60 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 07 60 E9 55 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 07 40 5B 53 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 05 60 8B 33 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 05 40 39 35 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 06 60 D8 66 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 06 40 6A 60 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 07 60 E9 55 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 07 40 5B 53 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 05 60 8B 33 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 05 40 39 35 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 06 60 D8 66 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 06 40 6A 60 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 07 60 E9 55 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 07 40 5B 53 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 05 60 8B 33 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 05 40 39 35 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 06 60 D8 66 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 06 40 6A 60 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 07 60 E9 55 ]
src/rs485.c:cp_recv:670 Received 8 bytes: [ 53 81 08 00 07 40 5B 53 ]
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 05 60 8B 33 ]
OSDP: CP: PD-1: 2000-01-01T01:25:03Z osdp_cp.c:898 [WARN ] No response in 200ms; probing (1)
src/rs485.c:cp_send:639 Sended 9 bytes: [ FF 53 01 08 00 06 60 D8 66 ]
src/rs485.c:cp_recv:670 Received 9 bytes: [ 53 81 09 00 06 41 04 42 DF ]
OSDP: CP: PD-1: 2000-01-01T01:25:04Z osdp_cp.c:419 [WARN ] PD replied with NAK(4) for CMD: POLL(60)
OSDP: CP: PD-1: 2000-01-01T01:25:04Z osdp_cp.c:1211 [ERROR] Going offline for 300 seconds; Was in 'Online' state
OSDP: CP: PD-1: 2000-01-01T01:25:04Z osdp_cp.c:1226 [DEBUG] StateChange: [Online] -> [Offline] (SC-Inactive)
Metadata
Metadata
Assignees
Labels
No labels