summaryrefslogtreecommitdiff
path: root/cmd/ipp
diff options
context:
space:
mode:
authorKevin Wallace <kevin@pentabarf.net>2026-02-27 04:14:41 -0800
committerKevin Wallace <kevin@pentabarf.net>2026-02-27 04:14:41 -0800
commita777eb3394b72795a75aa2a7f7db82f1c37fd93d (patch)
tree71c2d4690e6160a650c21700e9be148c9c161b87 /cmd/ipp
parentsimplify (diff)
exec -> systemd-run; more parsingHEADmaster
Diffstat (limited to 'cmd/ipp')
-rw-r--r--cmd/ipp/main.go34
1 files changed, 32 insertions, 2 deletions
diff --git a/cmd/ipp/main.go b/cmd/ipp/main.go
index 16317e0..21cf0fc 100644
--- a/cmd/ipp/main.go
+++ b/cmd/ipp/main.go
@@ -1,6 +1,7 @@
package main
import (
+ "encoding/binary"
"encoding/hex"
"flag"
"log"
@@ -15,10 +16,39 @@ var follow = flag.Bool("f", false, "don't exit after response")
func main() {
flag.Parse()
- log.SetFlags(log.Lshortfile)
+ log.SetFlags(log.Lshortfile | log.Ldate | log.Ltime | log.Lmicroseconds)
+ log.Println("start")
wc := make(chan struct{}, 1)
cv, err := cvend.Open(cvend.Path, func(msgType byte, msgData []byte) {
- log.Printf("ipp %02x\n%s", msgType, hex.Dump(msgData))
+ switch msgType {
+ case 0x07:
+ log.Printf("Heartbeat(%s)", hex.EncodeToString(msgData))
+ case 0x0f:
+ log.Printf("Startup(%s)", hex.EncodeToString(msgData))
+ case 0xed:
+ if len(msgData) == 0 {
+ log.Printf("Log()")
+ } else {
+ log.Printf("Log(%d) %q", msgData[0], string(msgData[1:]))
+ }
+ case 0xbe:
+ if len(msgData) < 22 || len(msgData) < 22+int(msgData[21]) {
+ log.Printf("PICCRead(short)\n%s", hex.Dump(msgData))
+ } else {
+ _ = msgData[:11] // unknown
+ uid := msgData[11:18]
+ atqa := binary.LittleEndian.Uint16(msgData[18:20])
+ sak := msgData[20]
+ atrLen := msgData[21]
+ atr := msgData[22 : 22+atrLen]
+ _ = msgData[22+atrLen:] // unknown
+ log.Printf("PICCRead(uid %s atqa 0x%04x sak %02x atr %s)\n%s", hex.EncodeToString(uid), atqa, sak, hex.EncodeToString(atr), hex.Dump(msgData))
+ }
+ case 0xd1:
+ log.Printf("EMVTransactionSuccessUnk\n%s", hex.Dump(msgData))
+ default:
+ log.Printf("ipp %02x\n%s", msgType, hex.Dump(msgData))
+ }
select {
case wc <- struct{}{}:
default: