6#define LOC QString("LAVCInfo(): ")
8bool LinuxAVCInfo::Update(uint64_t _guid, raw1394handle_t handle,
20 rom1394_directory dir;
21 if (rom1394_get_directory(handle, _node, &dir) < 0)
25 m_vendorid = dir.vendor_id;
26 m_modelid = dir.model_id;
27 m_specid = dir.unit_spec_id;
28 m_firmware_revision = dir.unit_sw_version;
29 m_product_name = QString(
"%1").arg(dir.label);
31 if (avc1394_subunit_info(handle, m_node, (uint32_t*)m_unit_table.data()) < 0)
32 m_unit_table.fill(0xff);
37bool LinuxAVCInfo::OpenPort(
void)
39 LOG(VB_RECORD, LOG_INFO,
40 LOC + QString(
"Getting raw1394 handle for port %1").arg(m_port));
41 m_fwHandle = raw1394_new_handle_on_port(m_port);
45 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Unable to get handle for " +
46 QString(
"port: %1").arg(m_port) +
ENO);
54bool LinuxAVCInfo::ClosePort(
void)
58 LOG(VB_RECORD, LOG_INFO,
LOC +
"Releasing raw1394 handle");
59 raw1394_destroy_handle(m_fwHandle);
66bool LinuxAVCInfo::SendAVCCommand(
67 const std::vector<uint8_t> &_cmd,
68 std::vector<uint8_t> &result,
71 retry_cnt = (retry_cnt < 0) ? 2 : retry_cnt;
75 if (!m_fwHandle || (m_node < 0))
78 std::vector<uint8_t> cmd = _cmd;
79 while (cmd.size() & 0x3)
82 if (cmd.size() > 4096)
85 std::array<uint32_t,1024> cmdbuf {};
86 for (
size_t i = 0; i < cmd.size(); i+=4)
87 cmdbuf[i>>2] = cmd[i]<<24 | cmd[i+1]<<16 | cmd[i+2]<<8 | cmd[i+3];
89 uint result_length = 0;
91 uint32_t *ret = avc1394_transaction_block2(
92 m_fwHandle, m_node, cmdbuf.data(), cmd.size() >> 2,
93 &result_length, retry_cnt);
98 for (
uint i = 0; i < result_length; i++)
100 result.push_back((ret[i]>>24) & 0xff);
101 result.push_back((ret[i]>>16) & 0xff);
102 result.push_back((ret[i]>>8) & 0xff);
103 result.push_back((ret[i]) & 0xff);
106 avc1394_transaction_block_close(m_fwHandle);
#define ENO
This can be appended to the LOG args with "+".
#define LOG(_MASK_, _LEVEL_, _QSTRING_)