-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for extended isotp ids and isotp padding
- Loading branch information
1 parent
5b58573
commit aea71f3
Showing
3 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package socketcan | ||
|
||
import ( | ||
"unsafe" | ||
"encoding/binary" | ||
) | ||
|
||
func getEndianness() binary.ByteOrder { | ||
buf := [2]byte{} | ||
*(*uint16)(unsafe.Pointer(&buf[0])) = uint16(0xABCD) | ||
|
||
switch buf { | ||
case [2]byte{0xCD, 0xAB}: | ||
return binary.LittleEndian | ||
case [2]byte{0xAB, 0xCD}: | ||
return binary.BigEndian | ||
default: | ||
panic("Could not determine native endianness.") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters