diff --git a/cec.go b/cec.go index c24c57b..a67cc21 100644 --- a/cec.go +++ b/cec.go @@ -7,15 +7,27 @@ import( ) type Device struct { + OSDName string + Vendor string LogicalAddress int ActiveSource bool PowerStatus string - VendorId uint64 PhysicalAddress string - OSDName string } -var logicalNames = []string{"TV", "Recording", "Recording2", "Tuner", "Playback", "Audio", "Tuner2", "Tuner3", "Playback2", "Recording3", "Tuner4", "Playback3", "Reserved", "Reserved2", "Free", "Broadcast"} +var logicalNames = []string{ "TV", "Recording", "Recording2", "Tuner", + "Playback","Audio", "Tuner2", "Tuner3", + "Playback2", "Recording3", "Tuner4", "Playback3", + "Reserved", "Reserved2", "Free", "Broadcast" } + +var vendorList = map[uint64]string{ 0x000039:"Toshiba", 0x0000F0:"Samsung", + 0x0005CD:"Denon", 0x000678:"Marantz", 0x000982:"Loewe", 0x0009B0:"Onkyo", + 0x000CB8:"Medion", 0x000CE7:"Toshiba", 0x001582:"Pulse Eight", + 0x0020C7:"Akai", 0x002467:"Aoc", 0x008045:"Panasonic", 0x00903E:"Philips", + 0x009053:"Daewoo", 0x00A0DE:"Yamaha", 0x00D0D5:"Grundig", + 0x00E036:"Pioneer", 0x00E091:"LG", 0x08001F:"Sharp", 0x080046:"Sony", + 0x18C086:"Broadcom", 0x6B746D:"Vizio", 0x8065E9:"Benq", + 0x9C645E:"Harman Kardon" } func Open(name string, deviceName string) { var config CECConfiguration @@ -67,7 +79,7 @@ func List() map[string]Device { dev.OSDName = GetDeviceOSDName(address) dev.PowerStatus = GetDevicePowerStatus(address) dev.ActiveSource = IsActiveSource(address) - dev.VendorId = GetDeviceVendorId(address) + dev.Vendor = GetVendorById(GetDeviceVendorId(address)) devices[logicalNames[address]] = dev } @@ -111,3 +123,7 @@ func GetLogicalAddressByName(name string) int { func GetLogicalNameByAddress(addr int) string { return logicalNames[addr] } + +func GetVendorById(id uint64) string { + return vendorList[id] +}