Skip to content

Commit f408a2c

Browse files
authored
Merge pull request #42 from nagisa/pcap-is-optional
Make pcap dependency optional
2 parents 36b0de2 + 50d61bc commit f408a2c

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ Contributions and PRs are welcome.
4747

4848
#### Install PCAP dev libraries
4949

50-
* Ensure you have install the libpcap-dev package
50+
* Optionally, you may want to have libpcap-dev package installed (if building with `-tags pcap`.)
5151

5252
#### Download, extract, and compile phev2mqtt
5353

5454
* Download the phev2mqtt archive
5555
* Extract it
56-
* Go into its the top level directory and run *go build*
57-
* Verify it runs with *./phev2mqtt -h*
56+
* Go into its the top level directory and run `go build`
57+
* Verify it runs with `./phev2mqtt -h`
5858

5959
### Connecting to the vehicle.
6060

@@ -238,10 +238,9 @@ then extract off the phone.
238238
*PCAP Remote* is a little more involved, but allows for live sniffing of the traffic.
239239

240240
Once you have downloaded the PCAP file(s) from the phone, you can analyse them with
241-
the command *phev2mqtt decode pcap <filename>*. Adjust the verbosity level (-v)
242-
between 'info', 'debug' and 'trace' for more details.
241+
the command *phev2mqtt decode pcap <filename>*. First build a `phev2mqtt` with pcap features:
242+
`go build -tags pcap`; you will need libpcap for this. Adjust the verbosity level (`-v`) between
243+
`info`, `debug` and `trace` for more details.
243244

244-
Additionally, the flag '--latency' will use the PCAP packet timestamps to decode
245+
Additionally, the flag `--latency` will use the PCAP packet timestamps to decode
245246
the packets with original timings which can help pinpoint app events.
246-
247-

cmd/file.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
"github.com/spf13/cobra"
2727
)
2828

29+
var securityKey *protocol.SecurityKey
30+
2931
// fileCmd represents the file command
3032
var fileCmd = &cobra.Command{
3133
Use: "file",

cmd/pcap.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ GNU General Public License for more details.
1414
You should have received a copy of the GNU General Public License
1515
along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
17+
18+
//go:build pcap
19+
1720
package cmd
1821

1922
import (
@@ -122,8 +125,6 @@ func processPayload(cmd *cobra.Command, data []byte, dir string) {
122125
}
123126
}
124127

125-
var securityKey *protocol.SecurityKey
126-
127128
var regs = map[byte]string{}
128129

129130
var pings bool

0 commit comments

Comments
 (0)