Wed, 03 Apr 2024 19:33:38 +0200
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * @brief One-wire devices |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Copyright (C) 2024 |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This is free software; you can redistribute it and/or modify it |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * under the terms of the GNU General Public License as published by the |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * Free Software Foundation; either version 2, or (at your option) any |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * later version. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * mbsePi-apps is distributed in the hope that it will be useful, but |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * General Public License for more details. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * You should have received a copy of the GNU General Public License |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * along with MBSE BBS; see the file COPYING. If not, write to the Free |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | */ |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | |
655
780cc08df263
State machine logging only when debug is active.
Michiel Broek <mbroek@mbse.eu>
parents:
654
diff
changeset
|
21 | extern int debug; |
780cc08df263
State machine logging only when debug is active.
Michiel Broek <mbroek@mbse.eu>
parents:
654
diff
changeset
|
22 | |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | #include "thermferm.h" |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | #include "statetbl.h" |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | #include "one-wire.h" |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
26 | #include "devices.h" |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
27 | #include "delay.h" |
659
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
28 | #include "futil.h" |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | #include "xutil.h" |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | extern sys_config Config; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | extern int my_shutdown; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | extern pthread_mutex_t mutexes[5]; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | int my_one_wire_state = 0; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | w1_list *w1_devices = NULL; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | static int one_wire(void); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | void *my_one_wire_loop(void *threadid) |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | my_one_wire_state = 1; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | syslog(LOG_NOTICE, "Thread my_one_wire_loop started"); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | /* |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | * Run the state machine |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | */ |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | one_wire(); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | /* |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | * Remove the dynamic tables. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | */ |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | syslog(LOG_NOTICE, "Thread my_one_wire_loop stopped"); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | my_one_wire_state = 0; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | return 0; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | SM_DECL(one_wire,(char *)"one-wire") |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | SM_STATES |
659
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
66 | ScanNew, |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
67 | ScanDel, |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
68 | Read2413, |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | Reading, |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | Missing |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | SM_NAMES |
659
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
72 | (char *)"ScanNew", |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
73 | (char *)"ScanDel", |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
74 | (char *)"Read2413", |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | (char *)"Reading", |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | (char *)"Missing" |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | SM_EDECL |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
79 | int found, i, rc; |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | FILE *fp; |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
81 | devices_list *device; |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | w1_list *dev_w1, *n_w1, *cur_w1 = NULL; |
659
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
83 | char buffer[25], w1type[10], *devfile = NULL; |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
84 | uint8_t state, output; |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | |
659
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
86 | SM_START(ScanNew) |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | |
659
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
88 | SM_STATE(ScanNew) |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | if (my_shutdown) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | SM_SUCCESS; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | /* |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | * Scan for current one-wire devices. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | */ |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | fp = fopen("/sys/devices/w1_bus_master1/w1_master_slaves", "r"); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | if (fp == NULL) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | syslog(LOG_NOTICE, "No w1_bus_master: %s", strerror(errno)); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | SM_ERROR; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | while ((fgets(buffer, 25, fp))) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | buffer[strlen(buffer)-1] = '\0'; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | strncpy(w1type, buffer, 2); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | w1type[2] = '\0'; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | /* |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | * Check if device is known and already detected. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | */ |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | if ((strcmp(w1type, (char *)"3a") == 0) || (strcmp(w1type, (char *)"10") == 0) || |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
111 | (strcmp(w1type, (char *)"22") == 0) || (strcmp(w1type, (char *)"28") == 0) || |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | (strcmp(w1type, (char *)"3b") == 0) || (strcmp(w1type, (char *)"42") == 0)) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | found = FALSE; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | for (dev_w1 = w1_devices; dev_w1; dev_w1 = dev_w1->next) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | if (strcmp(dev_w1->address, buffer) == 0) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | found = TRUE; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | dev_w1->timestamp = time(NULL); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | if (dev_w1->present != DEVPRESENT_YES) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | syslog(LOG_NOTICE, "One-wire device %s is back", buffer); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | pthread_mutex_lock(&mutexes[LOCK_ONE_WIRE]); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
121 | dev_w1->present = DEVPRESENT_YES; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | pthread_mutex_unlock(&mutexes[LOCK_ONE_WIRE]); |
659
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
123 | for (device = Config.devices; device; device = device->next) { |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
124 | if (strcmp(dev_w1->address, device->address) == 0) { |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
125 | pthread_mutex_lock(&mutexes[LOCK_DEVICES]); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
126 | device->present = DEVPRESENT_YES; |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
127 | pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
128 | } |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
129 | } |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
131 | break; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
132 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | if (found == FALSE) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | syslog(LOG_NOTICE, "One-wire device %s add new", buffer); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | n_w1 = (w1_list *)malloc(sizeof(w1_list)); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | n_w1->next = NULL; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | n_w1->address = xstrcpy(buffer); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | strncpy(n_w1->family, buffer, 2); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | n_w1->family[2] = '\0'; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | n_w1->present = DEVPRESENT_YES; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | n_w1->subdevices = (strcmp(w1type, (char *)"3a") == 0) ? 2:1; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | n_w1->timestamp = time(NULL); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | pthread_mutex_lock(&mutexes[LOCK_ONE_WIRE]); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | if (w1_devices == NULL) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | w1_devices = n_w1; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | cur_w1 = w1_devices; /* Point to first device */ |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | } else { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
150 | for (dev_w1 = w1_devices; dev_w1; dev_w1 = dev_w1->next) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | if (dev_w1->next == NULL) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | dev_w1->next = n_w1; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
153 | break; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
157 | pthread_mutex_unlock(&mutexes[LOCK_ONE_WIRE]); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | } else { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | syslog(LOG_NOTICE, "One-wire device %d %s unknown", strlen(buffer), buffer); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
161 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
162 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
163 | fclose(fp); |
659
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
164 | SM_PROCEED(ScanDel); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
165 | |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
166 | SM_STATE(ScanDel) |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
167 | |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
168 | if (my_shutdown) { |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
169 | SM_SUCCESS; |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
170 | } |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
171 | |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
172 | /* |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
173 | * Scan from the linked list if all devices are still present. |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
174 | */ |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
175 | for (dev_w1 = w1_devices; dev_w1; dev_w1 = dev_w1->next) { |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
176 | devfile = xstrcpy((char *)"/sys/bus/w1/devices/"); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
177 | devfile = xstrcat(devfile, dev_w1->address); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
178 | devfile = xstrcat(devfile, (char *)"/uevent"); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
179 | if (file_exist(devfile, R_OK) && (dev_w1->present == DEVPRESENT_YES)) { |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
180 | /* |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
181 | * Gone missing |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
182 | */ |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
183 | syslog(LOG_NOTICE, "One-wire device %s is missing", dev_w1->address); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
184 | pthread_mutex_lock(&mutexes[LOCK_ONE_WIRE]); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
185 | dev_w1->present = DEVPRESENT_NO; |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
186 | pthread_mutex_unlock(&mutexes[LOCK_ONE_WIRE]); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
187 | for (device = Config.devices; device; device = device->next) { |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
188 | if (strcmp(dev_w1->address, device->address) == 0) { |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
189 | pthread_mutex_lock(&mutexes[LOCK_DEVICES]); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
190 | device->present = DEVPRESENT_NO; |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
191 | pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
192 | } |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
193 | } |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
194 | } |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
195 | } |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
196 | |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
197 | SM_PROCEED(Read2413); |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
198 | |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
199 | SM_STATE(Read2413) |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
200 | |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
201 | if (my_shutdown) { |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
202 | SM_SUCCESS; |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
203 | } |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
204 | |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
205 | for (dev_w1 = w1_devices; dev_w1; dev_w1 = dev_w1->next) { |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
206 | if (strcmp(dev_w1->family, "3a") == 0) { |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
207 | syslog(LOG_NOTICE, "ds2413 %s", dev_w1->address); |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
208 | for (i = 0; i < 2; i++) { |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
209 | for (device = Config.devices; device; device = device->next) { |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
210 | if ((strcmp(dev_w1->address, device->address) == 0) && (device->subdevice == i) && (device->direction == DEVDIR_IN_BIN)) { |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
211 | /* |
657
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
212 | * First make sure that this device is configured as input |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
213 | * to drive the output high. Fix if programmed as output. |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
214 | */ |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
215 | if ((rc = read_w1(device->address, (char *)"state")) >= 0) { |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
216 | state = (unsigned int)rc; |
657
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
217 | output = ((state & 0x02) >> 1) + ((state & 0x08) >> 2); /* Both latch states */ |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
218 | if ((i == 0) && ((state & 0x02) == 0)) { /* Fix A side */ |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
219 | syslog(LOG_NOTICE, "One-wire device %s-%d out %04x -> %04x", dev_w1->address, i, output, output | 0x01); |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
220 | output |= 0x01; |
657
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
221 | write_w1(device->address, (char *)"output", output); |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
222 | mDelay(10); |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
223 | if ((rc = read_w1(device->address, (char *)"state")) >= 0) /* Read PIO again */ |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
224 | state = (unsigned int)rc; |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
225 | } |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
226 | if ((i == 1) && ((state & 0x08) == 0)) { /* Fix B side */ |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
227 | syslog(LOG_NOTICE, "One-wire device %s-%d out %04x -> %04x", dev_w1->address, i, output, output | 0x02); |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
228 | output |= 0x02; |
657
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
229 | write_w1(device->address, (char *)"output", output); |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
230 | mDelay(10); |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
231 | if ((rc = read_w1(device->address, (char *)"state")) >= 0) /* Read PIO again */ |
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
232 | state = (unsigned int)rc; |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
233 | } |
657
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
234 | |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
235 | pthread_mutex_lock(&mutexes[LOCK_DEVICES]); |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
236 | /* |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
237 | * Read PIOA or PIOB pin state bits |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
238 | */ |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
239 | if (device->subdevice == 0) |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
240 | device->value = (rc & 0x01) ? 0 : 1; |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
241 | else if (device->subdevice == 1) |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
242 | device->value = (rc & 0x04) ? 0 : 1; |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
243 | device->timestamp = time(NULL); |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
244 | pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
245 | } |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
246 | mDelay(20); |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
247 | } |
657
38162f374842
Read ds2413 moved to one-wire thread. Only reprogram if it is an input and programmed as output.
Michiel Broek <mbroek@mbse.eu>
parents:
656
diff
changeset
|
248 | } /* for (device = Config.devices; ... */ |
656
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
249 | } |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
250 | } |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
251 | } |
ca47c742a25d
One-wire thread is now the first to start. The devices_detect() function now uses the detected one-wire linked list instead of scan the sysfs. Base code for ds2413 added in the state table, needs rework.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
252 | |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
253 | SM_PROCEED(Reading); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
254 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
255 | SM_STATE(Reading) |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
256 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
257 | if (my_shutdown) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
258 | SM_SUCCESS; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
259 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
260 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
261 | /* |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
262 | * cur_w1 points to the next not handled device. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
263 | */ |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
264 | if (cur_w1 != NULL) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
265 | |
659
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
266 | if ((strcmp(cur_w1->family, (char *)"10") == 0) || (strcmp(cur_w1->family, (char *)"22") == 0) || (strcmp(cur_w1->family, (char *)"28") == 0) || |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
267 | (strcmp(cur_w1->family, (char *)"3b") == 0) || (strcmp(cur_w1->family, (char *)"42") == 0)) { |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
268 | syslog(LOG_NOTICE, "Reading %s", cur_w1->address); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
269 | sleep(1); |
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
270 | } |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
271 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
272 | if (cur_w1->next != NULL) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
273 | cur_w1 = cur_w1->next; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
274 | } else { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
275 | cur_w1 = w1_devices; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
276 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
277 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
278 | } else { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
279 | sleep(1); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
280 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
281 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
282 | SM_PROCEED(Missing); |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
283 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
284 | SM_STATE(Missing) |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
285 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
286 | if (my_shutdown) { |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
287 | SM_SUCCESS; |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
288 | } |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
289 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
290 | sleep(1); |
659
bfab45f4d5cd
Added state to scan vanished one-wire devices. Update devices if a one-wire device returns on the bus.
Michiel Broek <mbroek@mbse.eu>
parents:
657
diff
changeset
|
291 | SM_PROCEED(ScanNew); |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
292 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
293 | SM_END |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
294 | SM_RETURN |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
295 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
296 |