Субота, лютого 17, 2018

Останні записи

Опублікував Автор: Створено: в Uncategorized

 https://wiki.openwrt.org/doc/howto/usb.i2c-tiny-usb

https://github.com/harbaum/I2C-Tiny-USB

 

Introduction

Several routers and embedded devices with OpenWRT-support are equipped with one or more USB ports. In order not to risk your warranty by opening your device and soldering an I²C bus to the GPIOs, you can use an USB-I²C adapter to connect to your I²C-devices (e.g. temperature sensors, RTCs, AD-converters, GPIO-expanders, LCD-Drivers). One of those adapters is called https://wiki.openwrt.org/lib/tpl/openwrt/../../images/external-link.png");">i2c-tiny-usb, developed by Till Harbaum. Biggest advantage is the low price (though not as cheap as the GPIO mod) and the support in the Linux kernel (thus making it possible to connect it to your computer running a recent Linux distribution and test it). Though you need some basic soldering skills, and at the moment you need to build OpenWRT from source.

Compiling the kernel module

Note: This module is now in trunk, called kmod-i2c-tiny-usb. You can use a https://wiki.openwrt.org/lib/tpl/openwrt/../../images/external-link.png");">snapshot and install this kernel module with opkg.
Follow the build instructions until you reach the topic building images. At that point you have to edit you kernel configuration:

make kernel_menuconfigMake sure the following items are selected:

  • Device Drivers > I2C support > I2C device interface <*> (to get access through /dev/i2c-X)
  • Device Drivers > I2C support > I2C Hardware Bus support > Tiny-USB adapter <*>
Continue with the build instructions.

Using the I²C bus - kernel module

Since the module is compiled into the kernel, the I2C-Tiny-USB adapter can be plugged in. The successful registration can be tested:

dmesg | tail usb 1-3.3: new low speed USB device using ehci_hcd and address 5 usb 1-3.3: New USB device found, idVendor=0403, idProduct=c631 usb 1-3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 1-3.3: Product: i2c-tiny-usb usb 1-3.3: Manufacturer: Till Harbaum usb 1-3.3: configuration #1 chosen from 1 choice i2c-tiny-usb 1-3.3:1.0: version 1.05 found at bus 001 address 005 i2c-adapter i2c-0: connected i2c-tiny-usb device usbcore: registered new interface driver i2c-tiny-usbThe same results are achieved by loading the kernel module by insmod. The current trunk module within kmod-i2c-tiny-usb package works just fine (requiring also kmod-i2c-core package).

Using the I²C bus - using the bus

First install the i2c-tools package. This will provide all necessary tools for you to work with the bus.

Searching for the bus

As you already can see in the dmesg listing, the i2c-0 device was created. The device node is visible under /dev/i2c-0. First of all, check the device is also visible for i2c tools. Running

i2cdetect -l

should print something like

i2c-0 i2c i2c-tiny-usb at bus 001 device 004 I2C adapter

This is a good sign. We can show the implemented functions by running

i2cdetect -F 0

and it will print something like

Functionalities implemented by /dev/i2c-0: I2C yes SMBus Quick Command yes SMBus Send Byte yes SMBus Receive Byte yes SMBus Write Byte yes SMBus Read Byte yes SMBus Write Word yes SMBus Read Word yes SMBus Process Call yes SMBus Block Write yes SMBus Block Read no SMBus Block Process Call no SMBus PEC no I2C Block Write yes I2C Block Read yes

Searching for the devices

Now, we can search for devices, connected to the bus:

i2cdetect 0

will scan the bus and show available devices, similar to this:

WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-0. I will probe address range 0x03-0x77. Continue? [Y/n] 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: – – – – – – – – – – – – – 10: – – – – – – – – – – – – – – – – 20: 20 – – – – – – – – – – – – – – – 30: – – – – – – – – – – – – – – – – 40: – – – – – – – – – – – – – – – – 50: – – – – – – – – – – – – – – – – 60: – – – – – – – – – – – – – – – – 70: – – – – – – – –

Should you be anoyed by the Y/n question, you can use the -y switch to avoid it ;)

As you can see, I have an i2c device accessible on address 0x20 on the bus number 0.

Accessing the example device

My device is actually a https://wiki.openwrt.org/lib/tpl/openwrt/../../images/external-link.png");">MCP23017 - 16 port GPIO expander. First I have to set the directions of the inputs and outputs - as this device possess 2 ports (A and B), I have to set the direction for both of them - setting a bit to 0 will cause it to switch to output, setting the bit to 1 will cause to switch to input. The address to set the direction for port A is 0x00, for port B it's 0x01. Therefore to set the first 8 channels (port A) to output, I'd run

i2cset -y 0 0x20 0x00 0

That means use the device at the address 0x20 on the bus /dev/i2c-0, set its address 0x00 to zero value. The -y switch is there just to avoid the Y/n question. Also, to set the port B to input, I'd issue following command:

i2cset -y 0 0x20 0x01 0xff

This will set all the pins for port B to input. To set the actual value for port A, the address 0x12 is utilized. Similar, for port B, the address is 0x13. Therefore to set first bit to logical 1, I'd issue (assuming I already set the port's bit for output):

i2cset -y 0 0x20 0x12 1

Should you have some LED connected to the port, it will shine bright now. To turn it off, simply issue the following:

i2cset -y 0 0x20 0x12 0

Should some input be set on the port B, one can read its value by using following command:

i2cget -y 0 0x20 0x13

The result will be something like 0x00 (corresponding to the logical values presented to the actual pins).

Using this approach, you can enrich the OpenWRT device with multiple I/O channels.

I've already tested MCP23017, MCP23008, some i2c temperature sensors and EEPROM - all working just fine.

Precaution

This I²C bus operates at 5V. Make sure not to connect I²C devices incompatible with this voltage level!

Переглядів: 15
0

Опублікував Автор: Створено: в Uncategorized
Install the necessary packages before you can build/install ssh2 extension
yum install gcc php-devel php-pear libssh2 libssh2-devel make
Install the extension, (hit enter for autodetect when it prompts you)
pecl install -f ssh2
Once the install is completed, you just have to tell PHP to load the extension when it boots.echo extension=ssh2.so > /etc/php.d/ssh2.ini
Restart your webserver and test to see if the changes took effect.
service httpd restart
You can check it installed with the following command
php -m | grep ssh2
Переглядів: 24
0

Опублікував Автор: Створено: в Uncategorized

розписувати шось немає бажання .. 

спробую залишити основні теми і методики .. 

мета така .. є два диска які працюють в масиві mdadm raid1 

...
Переглядів: 221
0

Опублікував Автор: Створено: в Uncategorized

https://www.howtoforge.com/how-to-resize-raid-partitions-shrink-and-grow-software-raid

 

How To Resize RAID Partitions (Shrink & Grow) (Software RAID)

Version 1.0 
Author: Falko Timme 


This article describes how you can shrink and grow existing software RAID partitions. I have tested this with non-LVM RAID1 partitions that use ext3 as the file system. I will describe this procedure for an intact RAID array and also a degraded RAID array.

If you use LVM on your RAID partitions, the procedure will be different, so do not use this tutorial in this case!

...
Переглядів: 191
0

Опублікував Автор: Створено: в Soft
Переглядів: 417
0

Опублікував Автор: Створено: в Uncategorized
Переглядів: 405
0

Опублікував Автор: Створено: в Uncategorized

npm update socket.io

https://socket.io/

 

...
Переглядів: 417
0

Опублікував Автор: Створено: в Uncategorized

при будь якій роботі з дисками з яких грузиться лінукс треба обовязково перевіряти налаштування grub

ситуація така, 

в робочій системі яка складалася з raid 1  (mdadm)

...
Переглядів: 372
0

Опублікував Автор: Створено: в Uncategorized
[root var]# mdadm --detail /dev/md126
/dev/md126:
Version : 1.0
Creation Time : Mon Dec 14 12:11:26 2015
Raid Level : raid1
Array Size : 125033344 (119.24 GiB 128.03 GB)
Used Dev Size : 125033344 (119.24 GiB 128.03 GB)
Raid Devices : 3
Total Devices : 2
Persistence : Superblock is persistent

Intent Bitmap : Internal

Update Time : Fri Jun 16 21:50:39 2017
State : active, degraded
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

Name : localhost.localdomain:ssdraid
UUID : f3c9263f:6ae4f489:1fc15cc0:e38807fc
Events : 794672

Number Major Minor RaidDevice State
2 8 2 0 active sync /dev/sda2
3 8 18 1 active sync /dev/sdb2
4 0 0 4 removed
[roo var]# mdadm -G /dev/md126 --raid-devices=2
raid_disks for /dev/md126 set to 2
[ro28 var]# mdadm --detail /dev/md126
/dev/md126:
Version : 1.0
Creation Time : Mon Dec 14 12:11:26 2015
Raid Level : raid1
Array Size : 125033344 (119.24 GiB 128.03 GB)
Used Dev Size : 125033344 (119.24 GiB 128.03 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent

Intent Bitmap : Internal

Update Time : Fri Jun 16 21:53:38 2017
State : active
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

Name : localhost.localdomain:ssdraid
UUID : f3c9263f:6ae4f489:1fc15cc0:e38807fc
Events : 795199

Number Major Minor RaidDevice State
2 8 2 0 active sync /dev/sda2
3 8 18 1 active sync /dev/sdb2
Позначки: mdadm raid
Переглядів: 353
0

Опублікував Автор: Створено: в Uncategorized

прошивку качати тут :https://www.broadcom.com/support/download-search/?pg=&pf=&pn=SAS+9211-8i+Host+Bus+Adapter&po=&pa=&dk=#tab-current-Firmware

IR - Integrated RAID

IT- Initiator-Target, (Host Bus Adapter HBA)

...
Позначки: lsi raid sas
Переглядів: 415
0

Опублікував Автор: Створено: в Uncategorized

аємо клон IMAX B6 на контролері  ATMEGA32A куплений за 15$ з копійками

потім докуплено на аліекспресі USBISP USBASP  AVR Programmer 1,2$

основні ссилки:

https://youtu.be/hfklF_EA1tk

https://github.com/stawel/cheali-charger

https://github.com/stawel/cheali-charger/blob/master/docs/flashing.md

http://www.fischl.de/usbasp/

Переглядів: 523
5 1

Опублікував Автор: Створено: в Uncategorized

/вираз/ між ці дві риски поміщаємо вираз

/вираз/ i символ і означає прапорець

 

...
Переглядів: 419
0

Опублікував Автор: Створено: в Uncategorized
# memtester 5000 1
memtester version 4.2.1 (64-bit)
Copyright (C) 2010 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 5000MB (5242880000 bytes)
got 5000MB (5242880000 bytes), trying mlock ...locked.
Loop 1/1:
Stuck Address : ok
Random Value : ok
Compare XOR : ok
Compare SUB : ok
Compare MUL : ok
Compare DIV : ok
Compare OR : ok
Compare AND : ok
Sequential Increment: ok
Solid Bits : ok
Block Sequential : ok
Checkerboard : ok
Bit Spread : ok
Bit Flip : ok
Walking Ones : ok
Walking Zeroes : ok
8-bit Writes : ok
16-bit Writes : ok

Done.
Переглядів: 430
0

Опублікував Автор: Створено: в Uncategorized

[ro47 ~]# upsc -l
myups
[ro47 ~]# upsc myups

battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.mfr.date: 20xxxxx4
battery.runtime: 3060
battery.runtime.low: 120
battery.temperature: 31.5
battery.type: PbAc
battery.voltage: 27.4
battery.voltage.nominal: 24.0
device.mfr: American Power Conversion
device.model: Smxxxxx00
device.serial: ASxxxxxxxxx
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.6.5
driver.version.data: APC HID 0.95
driver.version.internal: 0.37
input.sensitivity: high
input.transfer.high: 253
input.transfer.low: 208
input.transfer.reason: input voltage out of range
input.voltage: 216.0
output.current: 1.45
output.frequency: 50.0
output.voltage: 216.0
output.voltage.nominal: 220.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.firmware: 652.12.I
ups.firmware.aux: 4.2
ups.load: 42.9
ups.mfr: American Power Conversion
ups.mfr.date: 20xxxxxx9
ups.model: Smxxxxxxxxx0
ups.productid: 0002
ups.serial: Axxxxxxxxxx
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: -1
ups.timer.shutdown: -1
ups.timer.start: -1
ups.vendorid: 051d

 

...
Позначки: ups
Переглядів: 437
0

Опублікував Автор: Створено: в Uncategorized
Переглядів: 542
0

Опублікував Автор: Створено: в Uncategorized

приблизно така задача

треба пропихнути socket.io через apache

приблизно принцип роботи такий 

...
Позначки: httpd socket.io
Переглядів: 422
0

Опублікував Автор: Створено: в Uncategorized

https://forum.xda-developers.com/s7-active/how-to/s7-active-sm-g891a-ota-updates-firmware-t3540866/page9

First number after S or U is bootloader number, in S7 Edge we have U4BQA6 witch red number indicate that bootloader is V4
U or S - Update Software or Security Update
4 - number after S or U Bootloader version
B - next version of Android. In example if last (6.1.1) was A next (7.0) will be B
Q - Year, A will be 01, Q- is 17
A - Month of creation of software , A-January, last one was K with was November we did not have L - December (edge users) because last security patch is from November. 
Last number is version of software patch , can be multiple for same month release on different month

 

...
Позначки: s7 active
Переглядів: 441
0

Опублікував Автор: Створено: в Uncategorized
Позначки: iptables Linux raid
Переглядів: 1127
0

Опублікував Автор: Створено: в Uncategorized

https://ma.ttias.be/enable-disable-service-at-boot-on-centos-7/

This post will show you how to enable or disable a service to start on boot, on a RHEL or CentOS 7.

Check if the service starts on boot

You manage your services on RHEL/CentOS 7 through systemctl, the systemd service manager.

...
Переглядів: 1315
0

Опублікував Автор: Створено: в Uncategorized
фаервол в LinuxДоброго времени, читатели и гости моего блога. C этой статьи начну серию статей о подсистеме Netfilter/iptables в Linux. В данной статье приведу основные понятия работы netfilter в Linux. Для понимания данной темы, обязательно советую ознакомиться со статьями Основные понятия сетей,Настройка сети в Linux, диагностика и мониторинг и Настройка и управление сетевой подсистемой Linux (iproute2).
Переглядів: 702
0