[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4678: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4680: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4681: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4682: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
virt2real.ru • Просмотр темы - Нужен драйвер SMBus
Страница 1 из 2

Нужен драйвер SMBus

СообщениеДобавлено: 27 мар 2014, 16:41
holmes
Здравствуйте уважаемые разработчики. Вопрос скорее к вам.

Можно ли подключать устройство с SMBus к I2C в2р? И можно ли сделать драйвер для SMBus?
Я так понял что спецификация для SMBus одна
А вот что-то из описания ядра линуха

Re: Нужен драйвер SMBus

СообщениеДобавлено: 31 мар 2014, 19:14
Gol

Re: Нужен драйвер SMBus

СообщениеДобавлено: 31 мар 2014, 22:42
holmes
Просто может я еще не до конца скурил информацию по работе с i2c на в2р (и в целом о внутренней организации протокола), но у меня так и не сформировалось представление как реализовать общение с девайсом. Конкретно это OpenUPS от mini-box.
В pdf по первой ссылке примерно на странице 28 начинается описание протокола, и не знаю как это реализовать.
По сути там такой же протокол как в ноутбучных аккках (девайс для подобного применения и делался).
Я понимаю что это слишком частная проблема, но все же, если будет возможность, буду очень благодарен за любую помощь. Пока продолжаю курить доки и гугл.

Re: Нужен драйвер SMBus

СообщениеДобавлено: 01 апр 2014, 11:45
eagafonov
IMHO для начала надо определить, видно ли устройство на шине вообще. Для этого можно использовать i2cdetect.

На SO нашёлся как раз вопрос, в котором с примерами команд товарищ не может найти батарейку на шине.
http://stackoverflow.com/questions/1211 ... t-detected

Вообще с i2c устройствами можно работать как минимум двумя способами.

Номер раз - без использования специфического драйвера - через устройство /dev/i2c-x (/dev/i2c-1, /dev/i2c-2 и тaк далее)
Открывается файл, вызовами ioctl/read/write читаешь/пришешь регистры устройства.

Я в своё время нашёл пример работы с акселерометром MPU6050 на форуме RPI и адаптировал для виртурилки.
Код лежит тут https://github.com/eagafonov/mpu6050-demo (Осторожной, С++).
Обёртка для работы с i2c - в файлах i2c.{cpp,h}
Остальное - специфика для MPU6050 и различные конкретный примеры работы с этим модулем.

Второй способ - через ядрёный драйвер, который скрывает всю i2c-шную подноготную протокола и выдаёт пользователю протокол, специфичный для устройства. Не знаю, есть ли в ядре драйвер для батарейки, вроде через ACPI всё управление питанием идёт.

По опыту ковыряния драйвера для той же MPU6050 то ещё удовольствие, особенно без опыта kernel-development'а.
Хотя level-up можно получить в случае успеха :)

Как-то так.

Суммируя: должно работать но надо проверять.

Re: Нужен драйвер SMBus

СообщениеДобавлено: 10 апр 2014, 02:47
holmes
А можно как-нибудь скриптом прочитать WORD с шины i2c?

Re: Нужен драйвер SMBus

СообщениеДобавлено: 10 апр 2014, 11:52
eagafonov

Re: Нужен драйвер SMBus

СообщениеДобавлено: 10 апр 2014, 23:15
holmes
Не определяется устройство =(
Батарейка имеет адрес 0х70, как у моторшилда. Поэтому я убрал из автозагрузки motorshield и telegue чтоб драйвер не занимал шину.
Однако теперь i2cdetect вообще не видит ничего на 70 адресе.
Что можно предпринять?

Re: Нужен драйвер SMBus

СообщениеДобавлено: 10 апр 2014, 23:36
phoenix367

Re: Нужен драйвер SMBus

СообщениеДобавлено: 11 апр 2014, 00:33
holmes
Мультиплексирование не требуется, моторшилд отключен, а потом будет перенесен на 60 адрес (благо это возможно).
А вот адрес батарейки поменять невозможно.
Батарейка вот такая
Осцилла нет к сожалению.

Re: Нужен драйвер SMBus

СообщениеДобавлено: 11 апр 2014, 02:02
holmes
Хм, похоже батарейка определяется на 0х38, а не на 0х70.
Но на любой регистр выдает Read failed. i2cdump ничего не дал.