Friday, December 1, 2017

linux lsusb

lsusb -vd 2650:1616

echo -n -e '\x66\x6f\x6f' > /dev/hidraw0
echo -n -e \\x66\\x6f\\x6f > /dev/hidraw0


https://www.kernel.org/doc/Documentation/hid/hidraw.txt

libudev to locate hidraw
devices attached to the system.  There is a tutorial on libudev with a
working example at:
 http://www.signal11.us/oss/udev/

write()
--------
The write() function will write a report to the device. For USB devices, if
the device has an INTERRUPT OUT endpoint, the report will be sent on that
endpoint. If it does not, the report will be sent over the control endpoint,
using a SET_REPORT transfer.

The first byte of the buffer passed to write() should be set to the report
number.  If the device does not use numbered reports, the first byte should
be set to 0. The report data itself should begin at the second byte.

http://elixir.free-electrons.com/linux/latest/source/samples/hidraw/hid-example.c


http://www.signal11.us/oss/udev/

$/sys/class/hidraw/hidraw0$ ls
/sys/class/hidraw/hidraw0/device

/sys/bus/usb/devices/2-1.2/

DNS info on Linux


$ nmcli device show eth0

cat /etc/resolv.conf

Wednesday, November 29, 2017

Friday, November 3, 2017

github download a commit

wget https://github.com/{username}/{project name}/commit/{sha1}.patch

wget https://github.com/ebmajor/my_github_project/commit/4cea0bd9d9151c3036b59e4131c53339b1a0e1f5.patch


Thursday, November 2, 2017

openwrt open-wrt

Adding configuration options

If you would like configure your package installation/compilation in the menuconfig you can do the following: Add MENU:=1 to your package definition like this:
define Package/mjpg-streamer
  SECTION:=multimedia
  CATEGORY:=Multimedia
  TITLE:=MJPG-streamer
  DEPENDS:=@!LINUX_2_4 +libpthread-stubs +jpeg
  URL:=http://mjpg-streamer.wiki.sourceforge.net/
  MENU:=1
endef
Create a config key in the Makefile:
define Package/mjpg-streamer/config
 source "$(SOURCE)/Config.in"
endef
Create a Config.in file directory where the Makefile is located with the content like this:
 # Mjpg-streamer configuration
 menu "Configuration"
  depends on PACKAGE_mjpg-streamer

 config MJPEG_STREAMER_AUTOSTART
  bool "Autostart enabled"
  default n

  menu "Input plugins"
   depends on PACKAGE_mjpg-streamer
   config MJPEG_STREAMER_INPUT_FILE
    bool "File input plugin"
    help 
     You can stream pictures from jpg files on the filesystem
    default n
  
   config MJPEG_STREAMER_INPUT_UVC
    bool "UVC input plugin"
    help
     You can stream pictures from an Universal Video Class compatible webcamera
    default y
  
   config MJPEG_STREAMER_FPS
    depends MJPEG_STREAMER_INPUT_UVC
    int "Maximum FPS"
    default 15

   config MJPEG_STREAMER_PICT_HEIGHT
    depends MJPEG_STREAMER_INPUT_UVC
    int "Picture height"
    default 640

   config MJPEG_STREAMER_PICT_WIDTH
    depends MJPEG_STREAMER_INPUT_UVC
    int "Picture width"
    default 480


   config MJPEG_STREAMER_DEVICE
    depends MJPEG_STREAMER_INPUT_UVC
    string "Device"
    default /dev/video0
 
   config MJPEG_STREAMER_INPUT_GSPCA
    bool "GSPCA input plugin"
    help
     You can stream pictures from a gspca supported webcamera Note this module is deprecated, use the UVVC plugin instead
    default n
  endmenu
 
  # ......
 
 endmenu
Above you can see examples for various type config parameters.
And finally you can check your configuration parameters in your Makefile in the following way: (Note that you can reference to the parameters value with it name prefixed with CONFIG_)
ifeq ($(CONFIG_MJPEG_STREAMER_INPUT_UVC),y)
 $(CP) $(PKG_BUILD_DIR)/input_uvc.so $(1)/usr/lib
endif