summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian König <chrissi@zweiundvierzig.(none)>2010-05-25 21:17:02 +0200
committerChristian König <chrissi@zweiundvierzig.(none)>2010-05-25 21:17:02 +0200
commit104643686853c5d21aa7e742877559519c77078b (patch)
tree1a3528329898fcf82fa0f8cce6fc0224c9b6bfef
parente677334947c9e4bd98d9e3956efe3df49021a272 (diff)
Implement "Give Physical Address"
-rw-r--r--cmd/cec.c5
-rw-r--r--lib/cec.h1
-rw-r--r--lib/commands.c11
3 files changed, 16 insertions, 1 deletions
diff --git a/cmd/cec.c b/cmd/cec.c
index e1835c2..2736b2c 100644
--- a/cmd/cec.c
+++ b/cmd/cec.c
@@ -203,8 +203,11 @@ int main(int argc, const char* argv[])
} else if (!strncmp("-scan", argv[i], 6)) {
for(addr=0x0; addr<=0xF; addr++) {
- CEC_TX_Ping(&device, addr);
+ if(CEC_TX_Ping(&device, addr) && addr != 0xF) {
+ CEC_TX_Give_Physical_Address(&device, addr);
+ }
}
+ CEC_Receive(&device);
} else if (!strncmp("-dump", argv[i], 6)) {
dump();
diff --git a/lib/cec.h b/lib/cec.h
index 32528c3..2b156b0 100644
--- a/lib/cec.h
+++ b/lib/cec.h
@@ -557,6 +557,7 @@ extern int CEC_TX_Abort(struct CEC_Device* device, uint8_t addr);
extern int CEC_TX_Give_Audio_Status(struct CEC_Device* device, uint8_t addr);
extern int CEC_TX_User_Control_Pressed(struct CEC_Device* device, uint8_t addr, enum CEC_UI_Commands command);
extern int CEC_TX_User_Control_Released(struct CEC_Device* device, uint8_t addr);
+extern int CEC_TX_Give_Physical_Address(struct CEC_Device* device, uint8_t addr);
extern int CEC_TX_Report_Physical_Address(struct CEC_Device* device, enum CEC_Device_Type device_type);
extern int CEC_TX_Active_Source(struct CEC_Device* device);
extern int CEC_TX_Set_System_Audio_Mode(struct CEC_Device* device, int mode);
diff --git a/lib/commands.c b/lib/commands.c
index 5076f00..4495045 100644
--- a/lib/commands.c
+++ b/lib/commands.c
@@ -81,6 +81,17 @@ int CEC_TX_User_Control_Released(struct CEC_Device* device, uint8_t addr)
return CEC_Transmit(device, &packet);
}
+int CEC_TX_Give_Physical_Address(struct CEC_Device* device, uint8_t addr)
+{
+ struct CEC_Packet packet = {
+ .length = 2,
+ .src = device->logical_address,
+ .dst = addr,
+ .opcode = CEC_Give_Physical_Address
+ };
+ return CEC_Transmit(device, &packet);
+}
+
int CEC_TX_Report_Physical_Address(struct CEC_Device* device, enum CEC_Device_Type device_type)
{
struct CEC_Packet packet = {