2019年6月30日 星期日

電腦dpkg lsit 安照日期方式

$ find /var/lib/dpkg/info -name "*.list" -exec stat -c $'%n\t%y' {} \; | \
   sed -e 's,/var/lib/dpkg/info/,,' -e 's,\.list\t,\t,' | \
   sort > ~/dpkglist.dates


adduser 2018-07-26 13:50:36.000000000 +0000 adwaita-icon-theme 2018-09-03 16:40:03.000000000 +0000 apt 2018-07-26 13:52:37.000000000 +0000 apt-transport-https 2018-08-08 23:54:04.000000000 +0000 aspell 2018-09-03 16:40:04.000000000 +0000 aspell-en 2018-09-03 16:40:04.000000000 +0000 base-files 2018-07-26 13:52:15.000000000 +0000 base-passwd 2018-07-26 13:50:36.000000000 +0000 bash 2018-07-26 13:52:16.000000000 +0000 binutils 2018-08-08 23:57:07.000000000 +0000 bsdutils 2018-07-26 13:52:16.000000000 +0000 build-essential 2018-08-08 23:57:17.000000000 +0000 bzip2 2018-08-08 23:57:07.000000000 +0000 ca-certificates 2018-08-08 23:54:05.000000000 +0000 cmake 2018-10-16 05:40:57.000000000 +0000 cmake-data 2018-10-16 05:40:56.000000000 +0000 coreutils 2018-07-26 13:52:17.000000000 +0000 cpp 2018-08-08 23:57:11.000000000 +0000 cpp-5 2018-08-08 23:57:11.000000000 +0000 cuda-command-line-tools-9-0 2018-08-08 23:57:21.000000000 +0000 cuda-core-9-0 2018-08-08 23:57:19.000000000 +0000 cuda-cublas-9-0 2018-08-08 23:55:25.000000000 +0000 cuda-cublas-dev-9-0 2018-08-08 23:57:28.000000000 +0000 cuda-cudart-9-0 2018-08-08 23:54:18.000000000 +0000 cuda-cudart-dev-9-0 2018-08-08 23:57:20.000000000 +0000 cuda-cufft-9-0 2018-08-08 23:55:35.000000000 +0000 cuda-cufft-dev-9-0 2018-08-08 23:57:35.000000000 +0000 cuda-curand-9-0 2018-08-08 23:55:37.000000000 +0000 cuda-curand-dev-9-0 2018-08-08 23:57:41.000000000 +0000 cuda-cusolver-9-0 2018-08-08 23:55:41.000000000 +0000 cuda-cusolver-dev-9-0 2018-08-08 23:57:42.000000000 +0000 cuda-cusparse-9-0 2018-08-08 23:55:45.000000000 +0000 cuda-cusparse-dev-9-0 2018-08-08 23:57:45.000000000 +0000 cuda-driver-dev-9-0 2018-08-08 23:57:20.000000000 +0000 cuda-libraries-9-0 2018-08-08 23:55:53.000000000 +0000 cuda-libraries-dev-9-0 2018-08-08 23:57:53.000000000 +0000 cuda-license-9-0 2018-08-08 23:54:18.000000000 +0000 cuda-minimal-build-9-0 2018-08-08 23:57:53.000000000 +0000 cuda-misc-headers-9-0 2018-08-08 23:57:18.000000000 +0000 cuda-npp-9-0 2018-08-08 23:55:52.000000000 +0000 cuda-npp-dev-9-0 2018-08-08 23:57:53.000000000 +0000 cuda-nvgraph-9-0 2018-08-08 23:55:47.000000000 +0000 cuda-nvgraph-dev-9-0 2018-08-08 23:57:47.000000000 +0000 cuda-nvml-dev-9-0 2018-08-08 23:57:53.000000000 +0000 cuda-nvrtc-9-0 2018-08-08 23:55:46.000000000 +0000 cuda-nvrtc-dev-9-0 2018-08-08 23:57:46.000000000 +0000 dash 2018-07-26 13:50:37.000000000 +0000 dbus 2018-09-03 16:39:49.000000000 +0000 dbus-x11 2018-09-03 16:40:04.000000000 +0000 dconf-gsettings-backend:amd64 2018-09-03 16:39:44.000000000 +0000 dconf-service 2018-09-03 16:39:44.000000000 +0000 debconf 2018-07-26 13:50:37.000000000 +0000 debianutils 2018-07-26 13:50:38.000000000 +0000 dh-python 2018-09-03 16:39:34.000000000 +0000 dictionaries-common 2018-09-03 16:40:04.000000000 +0000 diffutils 2018-07-26 13:50:38.000000000 +0000 dpkg 2018-07-26 13:52:18.000000000 +0000 dpkg-dev 2018-08-08 23:57:17.000000000 +0000 e2fslibs:amd64 2018-07-26 13:50:38.000000000 +0000 e2fsprogs 2018-07-26 13:50:39.000000000 +0000 emacs 2018-09-03 16:40:10.000000000 +0000 emacs24 2018-09-03 16:40:09.000000000 +0000 emacs24-bin-common 2018-09-03 16:40:07.000000000 +0000 emacs24-common 2018-09-03 16:40:07.000000000 +0000 emacs24-common-non-dfsg 2018-09-03 16:40:04.000000000 +0000 emacsen-common 2018-09-03 16:40:04.000000000 +0000 ffmpeg 2018-09-03 16:53:10.000000000 +0000 findutils 2018-07-26 13:50:39.000000000 +0000 fontconfig 2018-09-03 16:39:40.000000000 +0000 fontconfig-config 2018-09-03 16:39:39.000000000 +0000 fonts-arphic-bkai00mp 2018-10-16 05:39:56.000000000 +0000 fonts-arphic-bsmi00lp 2018-10-16 05:39:57.000000000 +0000 fonts-arphic-gbsn00lp 2018-10-16 05:39:57.000000000 +0000 fonts-arphic-gkai00mp 2018-10-16 05:39:57.000000000 +0000 fonts-arphic-ukai 2018-10-16 05:40:01.000000000 +0000 fonts-arphic-uming 2018-10-16 05:39:58.000000000 +0000 fonts-cabin 2018-09-03 16:40:10.000000000 +0000 fonts-cns11643-kai 2018-10-16 05:40:15.000000000 +0000 fonts-cns11643-sung 2018-10-16 05:40:21.000000000 +0000 fonts-comfortaa 2018-09-03 16:40:10.000000000 +0000 fonts-crosextra-caladea 2018-09-03 16:40:10.000000000 +0000 fonts-crosextra-carlito 2018-09-03 16:40:10.000000000 +0000 fonts-cwtex-fs 2018-10-16 05:40:02.000000000 +0000 fonts-cwtex-heib 2018-10-16 05:40:02.000000000 +0000 fonts-cwtex-kai 2018-10-16 05:40:03.000000000 +0000 fonts-cwtex-ming 2018-10-16 05:40:04.000000000 +0000 fonts-cwtex-yen 2018-10-16 05:40:05.000000000 +0000 fonts-dejavu 2018-10-16 05:40:05.000000000 +0000 fonts-dejavu-core 2018-09-03 16:39:38.000000000 +0000 fonts-dejavu-extra 2018-09-03 16:40:11.000000000 +0000 fonts-ebgaramond 2018-09-03 16:40:11.000000000 +0000 fonts-ebgaramond-extra 2018-09-03 16:40:11.000000000 +0000 fonts-font-awesome 2018-09-03 16:40:11.000000000 +0000 fonts-freefont-otf 2018-09-03 16:40:11.000000000 +0000 fonts-freefont-ttf 2018-09-03 16:39:39.000000000 +0000 fonts-gfs-artemisia 2018-09-03 16:40:12.000000000 +0000 fonts-gfs-complutum 2018-09-03 16:40:12.000000000 +0000 fonts-gfs-didot 2018-09-03 16:40:12.000000000 +0000 fonts-gfs-neohellenic 2018-09-03 16:40:12.000000000 +0000 fonts-gfs-olga 2018-09-03 16:40:12.000000000 +0000 fonts-gfs-solomos 2018-09-03 16:40:12.000000000 +0000 fonts-junicode 2018-09-03 16:40:12.000000000 +0000 fonts-lato 2018-09-03 16:39:40.000000000 +0000 fonts-liberation 2018-09-03 16:28:06.000000000 +0000 fonts-linuxlibertine 2018-09-03 16:40:12.000000000 +0000 fonts-lmodern 2018-09-03 16:40:13.000000000 +0000 fonts-lobster 2018-09-03 16:40:13.000000000 +0000 fonts-lobstertwo 2018-09-03 16:40:14.000000000 +0000 fonts-oflb-asana-math 2018-09-03 16:40:14.000000000 +0000 fonts-roboto-hinted 2018-09-03 16:40:14.000000000 +0000 fonts-sil-gentium 2018-09-03 16:40:14.000000000 +0000 fonts-sil-gentium-basic 2018-09-03 16:40:14.000000000 +0000 fonts-sil-gentiumplus 2018-09-03 16:40:15.000000000 +0000 fonts-stix 2018-09-03 16:40:36.000000000 +0000 fonts-wqy-zenhei 2018-10-16 05:39:59.000000000 +0000 g++ 2018-08-08 23:57:17.000000000 +0000 g++-5 2018-08-08 23:57:16.000000000 +0000 gcc 2018-08-08 23:57:15.000000000 +0000 gcc-5 2018-08-08 23:57:14.000000000 +0000 gcc-5-base:amd64 2018-07-26 13:52:34.000000000 +0000 gcc-6-base:amd64 2018-07-26 13:50:39.000000000 +0000 gconf2 2018-09-03 16:40:15.000000000 +0000 gconf2-common 2018-09-03 16:40:07.000000000 +0000 gconf-service 2018-09-03 16:40:07.000000000 +0000 gconf-service-backend 2018-09-03 16:40:07.000000000 +0000 gfortran 2018-10-16 05:40:07.000000000 +0000 gfortran-5 2018-10-16 05:40:06.000000000 +0000 git 2018-09-03 16:40:16.000000000 +0000 git-man 2018-09-03 16:40:15.000000000 +0000 glib-networking:amd64 2018-09-03 16:39:44.000000000 +0000 glib-networking-common 2018-09-03 16:39:43.000000000 +0000 glib-networking-services 2018-09-03 16:39:44.000000000 +0000 gnupg 2018-09-03 16:27:56.000000000 +0000 gnupg-curl 2018-08-08 23:54:05.000000000 +0000 gpgv 2018-09-03 16:27:55.000000000 +0000 grep 2018-07-26 13:52:18.000000000 +0000 gsettings-desktop-schemas 2018-09-03 16:39:44.000000000 +0000 gzip 2018-07-26 13:50:39.000000000 +0000 hicolor-icon-theme 2018-09-03 16:39:50.000000000 +0000 hostname 2018-07-26 13:50:39.000000000 +0000 humanity-icon-theme 2018-09-03 16:40:02.000000000 +0000 imagemagick-common 2018-09-03 16:39:40.000000000 +0000 init 2018-07-26 13:52:20.000000000 +0000 initscripts 2018-07-26 13:50:39.000000000 +0000 init-system-helpers 2018-07-26 13:52:19.000000000 +0000 inkscape 2018-09-03 16:40:22.000000000 +0000 insserv 2018-07-26 13:50:39.000000000 +0000 jed 2018-09-03 16:40:22.000000000 +0000 jed-common 2018-09-03 16:40:22.000000000 +0000 libacl1:amd64 2018-07-26 13:50:39.000000000 +0000 libapparmor1:amd64 2018-07-26 13:52:27.000000000 +0000 libapt-pkg5.0:amd64 2018-07-26 13:52:35.000000000 +0000 libarchive13:amd64 2018-10-16 05:40:57.000000000 +0000 libasan2:amd64 2018-08-08 23:57:12.000000000 +0000 libasn1-8-heimdal:amd64 2018-08-08 23:54:03.000000000 +0000 libasound2:amd64 2018-09-03 16:40:08.000000000 +0000 libasound2-data 2018-09-03 16:40:07.000000000 +0000 libaspell15:amd64 2018-09-03 16:40:03.000000000 +0000 libass5:amd64 2018-09-03 16:53:05.000000000 +0000 libasyncns0:amd64 2018-09-03 16:53:00.000000000 +0000 libatk1.0-0:amd64 2018-09-03 16:39:50.000000000 +0000 libatk1.0-data 2018-09-03 16:39:50.000000000 +0000 libatk-bridge2.0-0:amd64 2018-09-03 16:39:51.000000000 +0000 libatkmm-1.6-1v5:amd64 2018-09-03 16:40:16.000000000 +0000 libatomic1:amd64 2018-08-08 23:57:12.000000000 +0000 libatspi2.0-0:amd64 2018-09-03 16:39:51.000000000 +0000 libattr1:amd64 2018-07-26 13:50:39.000000000 +0000 libaudit1:amd64 2018-07-26 13:52:27.000000000 +0000 libaudit-common 2018-07-26 13:52:27.000000000 +0000 libavahi-client3:amd64 2018-09-03 16:39:51.000000000 +0000 libavahi-common3:amd64 2018-09-03 16:39:51.000000000 +0000 libavahi-common-data:amd64 2018-09-03 16:39:51.000000000 +0000 libavahi-glib1:amd64 2018-09-03 16:40:17.000000000 +0000 libavc1394-0:amd64 2018-09-03 16:53:05.000000000 +0000 libavcodec-ffmpeg56:amd64 2018-09-03 16:53:04.000000000 +0000 libavdevice-ffmpeg56:amd64 2018-09-03 16:53:10.000000000 +0000 libavfilter-ffmpeg5:amd64 2018-09-03 16:53:08.000000000 +0000 libavformat-ffmpeg56:amd64 2018-09-03 16:53:05.000000000 +0000 libavresample-ffmpeg2:amd64 2018-09-03 16:53:06.000000000 +0000 libavutil-ffmpeg54:amd64 2018-09-03 16:53:01.000000000 +0000 libblkid1:amd64 2018-07-26 13:52:30.000000000 +0000 libbluray1:amd64 2018-09-03 16:53:05.000000000 +0000 libboost-filesystem1.58.0:amd64 2018-09-03 16:39:52.000000000 +0000 libboost-system1.58.0:amd64 2018-09-03 16:39:52.000000000 +0000 libbs2b0:amd64 2018-09-03 16:53:06.000000000 +0000 libbsd0:amd64 2018-09-03 16:39:48.000000000 +0000 libbz2-1.0:amd64 2018-07-26 13:50:40.000000000 +0000 libc6:amd64 2018-07-26 13:52:26.000000000 +0000 libc6-dev:amd64 2018-08-08 23:57:10.000000000 +0000 libcaca0:amd64 2018-09-03 16:53:08.000000000 +0000 libcairo2:amd64 2018-09-03 16:39:50.000000000 +0000 libcairo-gobject2:amd64 2018-09-03 16:39:51.000000000 +0000 libcairomm-1.0-1v5:amd64 2018-09-03 16:40:16.000000000 +0000 libcap2:amd64 2018-07-26 13:50:42.000000000 +0000 libcap2-bin 2018-07-26 13:50:42.000000000 +0000 libcap-ng0:amd64 2018-09-03 16:39:48.000000000 +0000 libcapnp-0.5.3:amd64 2018-09-03 16:39:52.000000000 +0000 libc-bin 2018-07-26 13:52:34.000000000 +0000 libcc1-0:amd64 2018-08-08 23:57:11.000000000 +0000 libc-dev-bin 2018-08-08 23:57:07.000000000 +0000 libcdio13:amd64 2018-09-03 16:53:09.000000000 +0000 libcdio-cdda1:amd64 2018-09-03 16:53:09.000000000 +0000 libcdio-paranoia1:amd64 2018-09-03 16:53:09.000000000 +0000 libcdr-0.1-1:amd64 2018-09-03 16:40:17.000000000 +0000 libcilkrts5:amd64 2018-08-08 23:57:12.000000000 +0000 libcolord2:amd64 2018-09-03 16:39:51.000000000 +0000 libcomerr2:amd64 2018-07-26 13:50:42.000000000 +0000 libcroco3:amd64 2018-09-03 16:40:01.000000000 +0000 libcryptsetup4:amd64 2018-07-26 13:52:31.000000000 +0000 libcrystalhd3:amd64 2018-09-03 16:53:00.000000000 +0000 libcudnn7 2018-08-09 00:04:58.000000000 +0000 libcudnn7-dev 2018-08-09 00:05:14.000000000 +0000 libcups2:amd64 2018-09-03 16:39:51.000000000 +0000 libcupsfilters1:amd64 2018-09-03 16:40:22.000000000 +0000 libcupsimage2:amd64 2018-09-03 16:40:22.000000000 +0000 libcurl3:amd64 2018-10-16 05:40:57.000000000 +0000 libcurl3-gnutls:amd64 2018-08-08 23:54:04.000000000 +0000 libdatrie1:amd64 2018-09-03 16:39:53.000000000 +0000 libdb5.3:amd64 2018-07-26 13:52:38.000000000 +0000 libdbus-1-3:amd64 2018-09-03 16:39:48.000000000 +0000 libdbus-glib-1-2:amd64 2018-09-03 16:39:49.000000000 +0000 libdc1394-22:amd64 2018-09-03 16:53:09.000000000 +0000 libdconf1:amd64 2018-09-03 16:39:44.000000000 +0000 libdebconfclient0:amd64 2018-07-26 13:50:43.000000000 +0000 libdevmapper1.02.1:amd64 2018-07-26 13:50:43.000000000 +0000 libdpkg-perl 2018-08-08 23:57:17.000000000 +0000 libdrm2:amd64 2018-09-03 16:39:49.000000000 +0000 libdrm-amdgpu1:amd64 2018-09-03 16:39:55.000000000 +0000 libdrm-common 2018-09-03 16:39:49.000000000 +0000 libdrm-intel1:amd64 2018-09-03 16:39:55.000000000 +0000 libdrm-nouveau2:amd64 2018-09-03 16:39:55.000000000 +0000 libdrm-radeon1:amd64 2018-09-03 16:39:55.000000000 +0000 libedit2:amd64 2018-09-03 16:39:49.000000000 +0000 libegl1-mesa:amd64 2018-09-03 16:39:59.000000000 +0000 libelf1:amd64 2018-09-03 16:39:49.000000000 +0000 libenchant1c2a:amd64 2018-09-03 16:40:18.000000000 +0000 libepoxy0:amd64 2018-09-03 16:39:51.000000000 +0000 liberror-perl 2018-09-03 16:40:15.000000000 +0000 libexpat1:amd64 2018-09-03 16:39:32.000000000 +0000 libexpat1-dev:amd64 2018-09-03 16:40:22.000000000 +0000 libfdisk1:amd64 2018-07-26 13:52:39.000000000 +0000 libffi6:amd64 2018-08-08 23:54:01.000000000 +0000 libfftw3-double3:amd64 2018-09-03 16:39:40.000000000 +0000 libflac8:amd64 2018-09-03 16:53:09.000000000 +0000 libflite1:amd64 2018-09-03 16:53:07.000000000 +0000 libfontconfig1:amd64 2018-09-03 16:39:39.000000000 +0000 libfreetype6:amd64 2018-09-03 16:39:39.000000000 +0000 libfribidi0:amd64 2018-09-03 16:39:48.000000000 +0000 libgbm1:amd64 2018-09-03 16:39:54.000000000 +0000 libgc1c2:amd64 2018-09-03 16:40:17.000000000 +0000 libgcc1:amd64 2018-07-26 13:50:43.000000000 +0000 libgcc-5-dev:amd64 2018-08-08 23:57:13.000000000 +0000 libgconf-2-4:amd64 2018-09-03 16:40:07.000000000 +0000 libgcrypt20:amd64 2018-07-26 13:52:30.000000000 +0000 libgd3:amd64 2018-09-03 16:40:08.000000000 +0000 libgdbm3:amd64 2018-08-08 23:57:05.000000000 +0000 libgdk-pixbuf2.0-0:amd64 2018-09-03 16:39:52.000000000 +0000 libgdk-pixbuf2.0-common 2018-09-03 16:39:51.000000000 +0000 libgfortran3:amd64 2018-10-16 05:40:05.000000000 +0000 libgfortran-5-dev:amd64 2018-10-16 05:40:05.000000000 +0000 libgif7:amd64 2018-09-03 16:40:08.000000000 +0000 libgl1-mesa-dri:amd64 2018-09-03 16:39:59.000000000 +0000 libgl1-mesa-glx:amd64 2018-09-03 16:53:07.000000000 +0000 libglapi-mesa:amd64 2018-09-03 16:39:54.000000000 +0000 libglib2.0-0:amd64 2018-09-03 16:39:37.000000000 +0000 libglibmm-2.4-1v5:amd64 2018-09-03 16:40:16.000000000 +0000 libgme0:amd64 2018-09-03 16:53:05.000000000 +0000 libgmp10:amd64 2018-08-08 23:54:01.000000000 +0000 libgnomevfs2-0:amd64 2018-09-03 16:40:17.000000000 +0000 libgnomevfs2-common 2018-09-03 16:40:17.000000000 +0000 libgnutls30:amd64 2018-08-08 23:54:02.000000000 +0000 libgomp1:amd64 2018-08-08 23:57:11.000000000 +0000 libgpg-error0:amd64 2018-07-26 13:50:43.000000000 +0000 libgpm2:amd64 2018-09-03 16:39:40.000000000 +0000 libgraphite2-3:amd64 2018-09-03 16:39:53.000000000 +0000 libgs9:amd64 2018-09-03 16:40:24.000000000 +0000 libgs9-common 2018-09-03 16:40:23.000000000 +0000 libgsl2:amd64 2018-09-03 16:40:17.000000000 +0000 libgsm1:amd64 2018-09-03 16:53:00.000000000 +0000 libgssapi3-heimdal:amd64 2018-08-08 23:54:04.000000000 +0000 libgssapi-krb5-2:amd64 2018-08-08 23:54:03.000000000 +0000 libgtk2.0-0:amd64 2018-09-03 16:40:18.000000000 +0000 libgtk2.0-common 2018-09-03 16:40:17.000000000 +0000 libgtk-3-0:amd64 2018-09-03 16:40:00.000000000 +0000 libgtk-3-bin 2018-09-03 16:40:00.000000000 +0000 libgtk-3-common 2018-09-03 16:39:50.000000000 +0000 libgtkmm-2.4-1v5:amd64 2018-09-03 16:40:18.000000000 +0000 libgtkspell0 2018-09-03 16:40:19.000000000 +0000 libharfbuzz0b:amd64 2018-09-03 16:39:53.000000000 +0000 libharfbuzz-icu0:amd64 2018-09-03 16:40:24.000000000 +0000 libhcrypto4-heimdal:amd64 2018-08-08 23:54:03.000000000 +0000 libheimbase1-heimdal:amd64 2018-08-08 23:54:03.000000000 +0000 libheimntlm0-heimdal:amd64 2018-08-08 23:54:04.000000000 +0000 libhogweed4:amd64 2018-08-08 23:54:01.000000000 +0000 libhunspell-1.3-0:amd64 2018-09-03 16:40:18.000000000 +0000 libhx509-5-heimdal:amd64 2018-08-08 23:54:03.000000000 +0000 libice6:amd64 2018-09-03 16:39:41.000000000 +0000 libicu55:amd64 2018-09-03 16:39:43.000000000 +0000 libidn11:amd64 2018-08-08 23:54:02.000000000 +0000 libiec61883-0:amd64 2018-09-03 16:53:00.000000000 +0000 libijs-0.35:amd64 2018-09-03 16:40:23.000000000 +0000 libisl15:amd64 2018-08-08 23:57:10.000000000 +0000 libitm1:amd64 2018-08-08 23:57:12.000000000 +0000 libjack-jackd2-0:amd64 2018-09-03 16:53:09.000000000 +0000 libjbig0:amd64 2018-09-03 16:39:41.000000000 +0000 libjbig2dec0 2018-09-03 16:40:23.000000000 +0000 libjpeg8:amd64 2018-09-03 16:39:41.000000000 +0000 libjpeg-turbo8:amd64 2018-09-03 16:39:41.000000000 +0000 libjson-c2:amd64 2018-09-03 16:53:00.000000000 +0000 libjsoncpp1:amd64 2018-10-16 05:40:57.000000000 +0000 libjson-glib-1.0-0:amd64 2018-09-03 16:39:52.000000000 +0000 libjson-glib-1.0-common 2018-09-03 16:39:52.000000000 +0000 libk5crypto3:amd64 2018-08-08 23:54:02.000000000 +0000 libkeyutils1:amd64 2018-08-08 23:54:03.000000000 +0000 libkmod2:amd64 2018-07-26 13:52:31.000000000 +0000 libkpathsea6:amd64 2018-09-03 16:40:24.000000000 +0000 libkrb5-26-heimdal:amd64 2018-08-08 23:54:04.000000000 +0000 libkrb5-3:amd64 2018-08-08 23:54:03.000000000 +0000 libkrb5support0:amd64 2018-08-08 23:54:02.000000000 +0000 liblcms2-2:amd64 2018-09-03 16:39:41.000000000 +0000 libldap-2.4-2:amd64 2018-08-08 23:54:04.000000000 +0000 libllvm6.0:amd64 2018-09-03 16:39:58.000000000 +0000 liblockfile1:amd64 2018-09-03 16:39:41.000000000 +0000 liblockfile-bin 2018-09-03 16:39:41.000000000 +0000 liblqr-1-0:amd64 2018-09-03 16:39:41.000000000 +0000 liblsan0:amd64 2018-08-08 23:57:12.000000000 +0000 libltdl7:amd64 2018-09-03 16:39:41.000000000 +0000 liblua5.1-0:amd64 2018-09-03 16:40:24.000000000 +0000 libluajit-5.1-2:amd64 2018-09-03 16:40:24.000000000 +0000 libluajit-5.1-common 2018-09-03 16:40:24.000000000 +0000 liblz4-1:amd64 2018-07-26 13:51:43.000000000 +0000 liblzma5:amd64 2018-07-26 13:50:44.000000000 +0000 liblzo2-2:amd64 2018-10-16 05:40:56.000000000 +0000 libm17n-0:amd64 2018-09-03 16:40:09.000000000 +0000 libmagick++-6.q16-5v5:amd64 2018-09-03 16:40:19.000000000 +0000 libmagickcore-6.q16-2:amd64 2018-09-03 16:39:43.000000000 +0000 libmagickwand-6.q16-2:amd64 2018-09-03 16:39:43.000000000 +0000 libmirclient9:amd64 2018-09-03 16:39:53.000000000 +0000 libmircommon7:amd64 2018-09-03 16:39:52.000000000 +0000 libmircore1:amd64 2018-09-03 16:39:52.000000000 +0000 libmirprotobuf3:amd64 2018-09-03 16:39:53.000000000 +0000 libmodplug1:amd64 2018-09-03 16:53:05.000000000 +0000 libmount1:amd64 2018-07-26 13:52:32.000000000 +0000 libmp3lame0:amd64 2018-09-03 16:53:02.000000000 +0000 libmpc3:amd64 2018-08-08 23:57:07.000000000 +0000 libmpdec2:amd64 2018-09-03 16:39:33.000000000 +0000 libmpfr4:amd64 2018-08-08 23:57:07.000000000 +0000 libmpx0:amd64 2018-08-08 23:57:12.000000000 +0000 libnccl2 2018-08-08 23:55:56.000000000 +0000 libnccl-dev 2018-08-08 23:57:57.000000000 +0000 libncurses5:amd64 2018-07-26 13:50:44.000000000 +0000 libncursesw5:amd64 2018-07-26 13:50:44.000000000 +0000 libnettle6:amd64 2018-08-08 23:54:01.000000000 +0000 libnuma1:amd64 2018-09-03 16:53:01.000000000 +0000 libogg0:amd64 2018-09-03 16:53:00.000000000 +0000 libopenal1:amd64 2018-09-03 16:53:01.000000000 +0000 libopenal-data 2018-09-03 16:53:01.000000000 +0000 libopencv-core2.4v5:amd64 2018-09-03 16:53:08.000000000 +0000 libopencv-imgproc2.4v5:amd64 2018-09-03 16:53:08.000000000 +0000 libopenjpeg5:amd64 2018-09-03 16:53:02.000000000 +0000 libopus0:amd64 2018-09-03 16:53:02.000000000 +0000 liborc-0.4-0:amd64 2018-09-03 16:53:01.000000000 +0000 libotf0:amd64 2018-09-03 16:40:08.000000000 +0000 libp11-kit0:amd64 2018-08-08 23:54:02.000000000 +0000 libpam0g:amd64 2018-07-26 13:52:27.000000000 +0000 libpam-modules:amd64 2018-07-26 13:52:28.000000000 +0000 libpam-modules-bin 2018-07-26 13:52:28.000000000 +0000 libpam-runtime 2018-07-26 13:52:39.000000000 +0000 libpango-1.0-0:amd64 2018-09-03 16:39:53.000000000 +0000 libpangocairo-1.0-0:amd64 2018-09-03 16:39:54.000000000 +0000 libpangoft2-1.0-0:amd64 2018-09-03 16:39:54.000000000 +0000 libpangomm-1.4-1v5:amd64 2018-09-03 16:40:18.000000000 +0000 libpaper1:amd64 2018-09-03 16:40:23.000000000 +0000 libpaper-utils 2018-09-03 16:40:24.000000000 +0000 libpciaccess0:amd64 2018-09-03 16:39:55.000000000 +0000 libpcre3:amd64 2018-07-26 13:50:45.000000000 +0000 libperl5.22:amd64 2018-08-08 23:57:06.000000000 +0000 libpixman-1-0:amd64 2018-09-03 16:39:50.000000000 +0000 libpng12-0:amd64 2018-09-03 16:39:39.000000000 +0000 libpoppler58:amd64 2018-09-03 16:40:19.000000000 +0000 libpoppler-glib8:amd64 2018-09-03 16:40:19.000000000 +0000 libpopt0:amd64 2018-09-03 16:39:32.000000000 +0000 libpostproc-ffmpeg53:amd64 2018-09-03 16:53:08.000000000 +0000 libpotrace0 2018-09-03 16:40:24.000000000 +0000 libprocps4:amd64 2018-07-26 13:52:41.000000000 +0000 libprotobuf-lite9v5:amd64 2018-09-03 16:39:52.000000000 +0000 libproxy1v5:amd64 2018-09-03 16:39:43.000000000 +0000 libptexenc1:amd64 2018-09-03 16:40:25.000000000 +0000 libpthread-stubs0-dev:amd64 2018-09-03 16:40:25.000000000 +0000 libpulse0:amd64 2018-09-03 16:53:09.000000000 +0000 libpython2.7:amd64 2018-09-03 16:40:25.000000000 +0000 libpython2.7-dev:amd64 2018-09-03 16:40:27.000000000 +0000 libpython2.7-minimal:amd64 2018-09-03 16:39:46.000000000 +0000 libpython2.7-stdlib:amd64 2018-09-03 16:39:47.000000000 +0000 libpython3.5:amd64 2018-10-16 05:40:58.000000000 +0000 libpython3.5-minimal:amd64 2018-09-03 16:39:32.000000000 +0000 libpython3.5-stdlib:amd64 2018-09-03 16:39:33.000000000 +0000 libpython3-stdlib:amd64 2018-09-03 16:39:34.000000000 +0000 libpython-dev:amd64 2018-09-03 16:40:27.000000000 +0000 libpython-stdlib:amd64 2018-09-03 16:39:47.000000000 +0000 libquadmath0:amd64 2018-08-08 23:57:12.000000000 +0000 libraw1394-11:amd64 2018-09-03 16:53:00.000000000 +0000 libreadline6:amd64 2018-07-26 13:51:43.000000000 +0000 librest-0.7-0:amd64 2018-09-03 16:39:44.000000000 +0000 librevenge-0.0-0:amd64 2018-09-03 16:40:17.000000000 +0000 libroken18-heimdal:amd64 2018-08-08 23:54:03.000000000 +0000 librsvg2-2:amd64 2018-09-03 16:40:01.000000000 +0000 librsvg2-common:amd64 2018-09-03 16:40:01.000000000 +0000 librtmp1:amd64 2018-08-08 23:54:04.000000000 +0000 libsamplerate0:amd64 2018-09-03 16:53:00.000000000 +0000 libsasl2-2:amd64 2018-08-08 23:54:04.000000000 +0000 libsasl2-modules-db:amd64 2018-08-08 23:54:04.000000000 +0000 libschroedinger-1.0-0:amd64 2018-09-03 16:53:01.000000000 +0000 libsdl1.2debian:amd64 2018-09-03 16:53:09.000000000 +0000 libseccomp2:amd64 2018-07-26 13:52:32.000000000 +0000 libselinux1:amd64 2018-07-26 13:50:45.000000000 +0000 libsemanage1:amd64 2018-07-26 13:50:46.000000000 +0000 libsemanage-common 2018-07-26 13:50:45.000000000 +0000 libsensors4:amd64 2018-09-03 16:39:58.000000000 +0000 libsepol1:amd64 2018-07-26 13:50:46.000000000 +0000 libshine3:amd64 2018-09-03 16:53:02.000000000 +0000 libsigc++-2.0-0v5:amd64 2018-09-03 16:40:16.000000000 +0000 libslang2:amd64 2018-09-03 16:39:48.000000000 +0000 libslang2-modules:amd64 2018-09-03 16:40:22.000000000 +0000 libsm6:amd64 2018-09-03 16:39:44.000000000 +0000 libsmartcols1:amd64 2018-07-26 13:52:40.000000000 +0000 libsnappy1v5:amd64 2018-09-03 16:53:02.000000000 +0000 libsndfile1:amd64 2018-09-03 16:53:09.000000000 +0000 libsodium18:amd64 2018-09-03 16:53:08.000000000 +0000 libsoup2.4-1:amd64 2018-09-03 16:39:44.000000000 +0000 libsoup-gnome2.4-1:amd64 2018-09-03 16:39:44.000000000 +0000 libsoxr0:amd64 2018-09-03 16:53:02.000000000 +0000 libspeex1:amd64 2018-09-03 16:53:02.000000000 +0000 libsqlite3-0:amd64 2018-08-08 23:54:02.000000000 +0000 libss2:amd64 2018-07-26 13:50:46.000000000 +0000 libssh-gcrypt-4:amd64 2018-09-03 16:53:05.000000000 +0000 libssl1.0.0:amd64 2018-08-08 23:54:02.000000000 +0000 libstdc++-5-dev:amd64 2018-08-08 23:57:15.000000000 +0000 libstdc++6:amd64 2018-07-26 13:52:35.000000000 +0000 libswresample-ffmpeg1:amd64 2018-09-03 16:53:02.000000000 +0000 libswscale-ffmpeg3:amd64 2018-09-03 16:53:08.000000000 +0000 libsynctex1:amd64 2018-09-03 16:40:28.000000000 +0000 libsystemd0:amd64 2018-09-03 16:27:46.000000000 +0000 libtasn1-6:amd64 2018-08-08 23:54:02.000000000 +0000 libtbb2:amd64 2018-09-03 16:53:07.000000000 +0000 libtexlua52:amd64 2018-09-03 16:40:28.000000000 +0000 libtexluajit2:amd64 2018-09-03 16:40:28.000000000 +0000 libtext-iconv-perl 2018-09-03 16:39:48.000000000 +0000 libthai0:amd64 2018-09-03 16:39:53.000000000 +0000 libthai-data 2018-09-03 16:39:53.000000000 +0000 libtheora0:amd64 2018-09-03 16:53:02.000000000 +0000 libtiff5:amd64 2018-09-03 16:39:42.000000000 +0000 libtinfo5:amd64 2018-07-26 13:50:46.000000000 +0000 libtsan0:amd64 2018-08-08 23:57:12.000000000 +0000 libtwolame0:amd64 2018-09-03 16:53:03.000000000 +0000 libubsan0:amd64 2018-08-08 23:57:12.000000000 +0000 libudev1:amd64 2018-09-03 16:27:55.000000000 +0000 libusb-0.1-4:amd64 2018-07-26 13:51:44.000000000 +0000 libusb-1.0-0:amd64 2018-09-03 16:53:01.000000000 +0000 libustr-1.0-1:amd64 2018-07-26 13:50:46.000000000 +0000 libuuid1:amd64 2018-07-26 13:52:29.000000000 +0000 libva1:amd64 2018-09-03 16:53:03.000000000 +0000 libvdpau1:amd64 2018-09-03 16:53:10.000000000 +0000 libvisio-0.1-1:amd64 2018-09-03 16:40:19.000000000 +0000 libvorbis0a:amd64 2018-09-03 16:53:03.000000000 +0000 libvorbisenc2:amd64 2018-09-03 16:53:03.000000000 +0000 libvpx3:amd64 2018-09-03 16:40:08.000000000 +0000 libwavpack1:amd64 2018-09-03 16:53:03.000000000 +0000 libwayland-client0:amd64 2018-09-03 16:39:54.000000000 +0000 libwayland-cursor0:amd64 2018-09-03 16:39:54.000000000 +0000 libwayland-egl1-mesa:amd64 2018-09-03 16:40:00.000000000 +0000 libwayland-server0:amd64 2018-09-03 16:39:54.000000000 +0000 libwebp5:amd64 2018-09-03 16:53:03.000000000 +0000 libwind0-heimdal:amd64 2018-08-08 23:54:03.000000000 +0000 libwpd-0.10-10:amd64 2018-09-03 16:40:19.000000000 +0000 libwpg-0.3-3:amd64 2018-09-03 16:40:19.000000000 +0000 libwrap0:amd64 2018-09-03 16:53:01.000000000 +0000 libx11-6:amd64 2018-09-03 16:39:38.000000000 +0000 libx11-data 2018-09-03 16:39:38.000000000 +0000 libx11-dev:amd64 2018-09-03 16:40:29.000000000 +0000 libx11-xcb1:amd64 2018-09-03 16:39:54.000000000 +0000 libx264-148:amd64 2018-09-03 16:53:03.000000000 +0000 libx265-79:amd64 2018-09-03 16:53:03.000000000 +0000 libxau6:amd64 2018-09-03 16:39:37.000000000 +0000 libxau-dev:amd64 2018-09-03 16:40:28.000000000 +0000 libxaw7:amd64 2018-09-03 16:40:29.000000000 +0000 libxcb1:amd64 2018-09-03 16:39:38.000000000 +0000 libxcb1-dev:amd64 2018-09-03 16:40:28.000000000 +0000 libxcb-dri2-0:amd64 2018-09-03 16:39:54.000000000 +0000 libxcb-dri3-0:amd64 2018-09-03 16:39:54.000000000 +0000 libxcb-glx0:amd64 2018-09-03 16:53:07.000000000 +0000 libxcb-present0:amd64 2018-09-03 16:39:55.000000000 +0000 libxcb-render0:amd64 2018-09-03 16:39:50.000000000 +0000 libxcb-shape0:amd64 2018-09-03 16:53:09.000000000 +0000 libxcb-shm0:amd64 2018-09-03 16:39:50.000000000 +0000 libxcb-sync1:amd64 2018-09-03 16:39:55.000000000 +0000 libxcb-xfixes0:amd64 2018-09-03 16:39:55.000000000 +0000 libxcomposite1:amd64 2018-09-03 16:39:44.000000000 +0000 libxcursor1:amd64 2018-09-03 16:40:00.000000000 +0000 libxdamage1:amd64 2018-09-03 16:39:45.000000000 +0000 libxdmcp6:amd64 2018-09-03 16:39:37.000000000 +0000 libxdmcp-dev:amd64 2018-09-03 16:40:28.000000000 +0000 libxext6:amd64 2018-09-03 16:39:38.000000000 +0000 libxext-dev:amd64 2018-09-03 16:40:29.000000000 +0000 libxfixes3:amd64 2018-09-03 16:39:45.000000000 +0000 libxft2:amd64 2018-09-03 16:39:45.000000000 +0000 libxi6:amd64 2018-09-03 16:40:00.000000000 +0000 libxinerama1:amd64 2018-09-03 16:39:45.000000000 +0000 libxkbcommon0:amd64 2018-09-03 16:39:53.000000000 +0000 libxml2:amd64 2018-09-03 16:39:43.000000000 +0000 libxmu6:amd64 2018-09-03 16:40:29.000000000 +0000 libxpm4:amd64 2018-09-03 16:40:08.000000000 +0000 libxrandr2:amd64 2018-09-03 16:40:00.000000000 +0000 libxrender1:amd64 2018-09-03 16:39:45.000000000 +0000 libxshmfence1:amd64 2018-09-03 16:39:45.000000000 +0000 libxslt1.1:amd64 2018-09-03 16:40:20.000000000 +0000 libxt6:amd64 2018-09-03 16:40:08.000000000 +0000 libxv1:amd64 2018-09-03 16:53:01.000000000 +0000 libxvidcore4:amd64 2018-09-03 16:53:04.000000000 +0000 libxxf86vm1:amd64 2018-09-03 16:53:01.000000000 +0000 libyaml-0-2:amd64 2018-09-03 16:39:45.000000000 +0000 libzmq5:amd64 2018-09-03 16:53:08.000000000 +0000 libzvbi0:amd64 2018-09-03 16:53:04.000000000 +0000 libzvbi-common 2018-09-03 16:53:04.000000000 +0000 libzzip-0-13:amd64 2018-09-03 16:40:29.000000000 +0000 linux-libc-dev:amd64 2018-09-03 16:28:03.000000000 +0000 lmodern 2018-09-03 16:40:30.000000000 +0000 locales 2018-09-03 16:28:06.000000000 +0000 login 2018-07-26 13:52:20.000000000 +0000 lsb-base 2018-07-26 13:52:32.000000000 +0000 m17n-db 2018-09-03 16:40:09.000000000 +0000 make 2018-08-08 23:57:17.000000000 +0000 makedev 2018-07-26 13:52:41.000000000 +0000 mawk 2018-07-26 13:50:49.000000000 +0000 mime-support 2018-09-03 16:39:33.000000000 +0000 mount 2018-07-26 13:52:33.000000000 +0000 multiarch-support 2018-07-26 13:52:40.000000000 +0000 nano 2018-09-03 16:39:49.000000000 +0000 ncurses-base 2018-07-26 13:50:50.000000000 +0000 ncurses-bin 2018-07-26 13:50:50.000000000 +0000 netcat 2018-09-03 16:40:31.000000000 +0000 netcat-traditional 2018-09-03 16:40:30.000000000 +0000 openssh-client 2018-10-16 05:40:58.000000000 +0000 openssl 2018-08-08 23:54:04.000000000 +0000 pandoc 2018-09-03 16:40:32.000000000 +0000 pandoc-data 2018-09-03 16:40:31.000000000 +0000 passwd 2018-07-26 13:52:29.000000000 +0000 patch 2018-08-08 23:57:17.000000000 +0000 perl 2018-08-08 23:57:07.000000000 +0000 perl-base 2018-07-26 13:52:19.000000000 +0000 perl-modules-5.22 2018-08-08 23:57:06.000000000 +0000 poppler-data 2018-09-03 16:39:46.000000000 +0000 preview-latex-style 2018-09-03 16:40:32.000000000 +0000 procps 2018-07-26 13:52:41.000000000 +0000 psmisc 2018-09-03 16:39:49.000000000 +0000 python 2018-09-03 16:39:48.000000000 +0000 python2.7 2018-09-03 16:39:47.000000000 +0000 python2.7-dev 2018-09-03 16:40:32.000000000 +0000 python2.7-minimal 2018-09-03 16:39:46.000000000 +0000 python3 2018-09-03 16:39:37.000000000 +0000 python3.5 2018-09-03 16:39:34.000000000 +0000 python3.5-minimal 2018-09-03 16:39:33.000000000 +0000 python3-minimal 2018-09-03 16:39:33.000000000 +0000 python-dev 2018-09-03 16:40:32.000000000 +0000 python-minimal 2018-09-03 16:39:46.000000000 +0000 readline-common 2018-07-26 13:51:44.000000000 +0000 sed 2018-07-26 13:50:52.000000000 +0000 sensible-utils 2018-07-26 13:52:40.000000000 +0000 shared-mime-info 2018-09-03 16:39:50.000000000 +0000 slsh 2018-09-03 16:40:22.000000000 +0000 sudo 2018-09-03 16:28:06.000000000 +0000 systemd 2018-09-03 16:27:54.000000000 +0000 systemd-sysv 2018-09-03 16:27:55.000000000 +0000 sysvinit-utils 2018-07-26 13:50:55.000000000 +0000 sysv-rc 2018-07-26 13:50:55.000000000 +0000 t1utils 2018-09-03 16:40:32.000000000 +0000 tar 2018-07-26 13:52:33.000000000 +0000 tex-common 2018-09-03 16:40:13.000000000 +0000 texlive-base 2018-09-03 16:40:36.000000000 +0000 texlive-binaries 2018-09-03 16:40:33.000000000 +0000 texlive-fonts-extra 2018-09-03 16:41:07.000000000 +0000 texlive-fonts-recommended 2018-09-03 16:41:09.000000000 +0000 texlive-generic-recommended 2018-09-03 16:41:09.000000000 +0000 texlive-latex-base 2018-09-03 16:41:10.000000000 +0000 texlive-latex-extra 2018-09-03 16:41:14.000000000 +0000 texlive-latex-recommended 2018-09-03 16:41:11.000000000 +0000 texlive-pictures 2018-09-03 16:41:12.000000000 +0000 texlive-xetex 2018-09-03 16:41:16.000000000 +0000 tipa 2018-09-03 16:41:15.000000000 +0000 ttf-adf-accanthis 2018-09-03 16:40:36.000000000 +0000 ttf-adf-gillius 2018-09-03 16:40:36.000000000 +0000 ttf-adf-universalis 2018-09-03 16:40:36.000000000 +0000 tzdata 2018-10-16 05:40:00.000000000 +0000 ubuntu-keyring 2018-07-26 13:51:44.000000000 +0000 ubuntu-mono 2018-09-03 16:40:03.000000000 +0000 ucf 2018-09-03 16:39:39.000000000 +0000 unzip 2018-09-03 16:41:16.000000000 +0000 util-linux 2018-07-26 13:52:33.000000000 +0000 vim 2018-10-16 05:40:59.000000000 +0000 vim-common 2018-10-16 05:40:57.000000000 +0000 vim-runtime 2018-10-16 05:40:59.000000000 +0000 wget 2018-09-03 16:28:06.000000000 +0000 x11-common 2018-09-03 16:39:41.000000000 +0000 x11proto-core-dev 2018-09-03 16:40:28.000000000 +0000 x11proto-input-dev 2018-09-03 16:40:28.000000000 +0000 x11proto-kb-dev 2018-09-03 16:40:28.000000000 +0000 x11proto-xext-dev 2018-09-03 16:40:29.000000000 +0000 xdg-utils 2018-09-03 16:40:34.000000000 +0000 xkb-data 2018-09-03 16:39:48.000000000 +0000 xorg-sgml-doctools 2018-09-03 16:40:28.000000000 +0000 xtrans-dev 2018-09-03 16:40:28.000000000 +0000 xz-utils 2018-08-08 23:57:17.000000000 +0000 zlib1g:amd64 2018-07-26 13:52:35.000000000 +0000 zlib1g-dev:amd64 2018-10-16 05:40:59.000000000 +0000

2019年6月14日 星期五

Jetson nano系統從sd card搬移到usb3 ssd dongle

考慮將Jetson nano系統從sd card搬移到usb3 ssd dongle

https://devtalk.nvidia.com/default/topic/1051171/jetson-nano/how-to-connect-ssd-to-jetson-nano/

jetson nano監測cpu gpu 溫度

第一個方法,顯示的內容較為完整
$sudo  jtop


這裡是github來源

第二個方法,是早期監測gpu的方法,內容較為簡單

$sudo tegrastats

有關tegrastats操作可以查詢這裡



2016年8月26日 星期五

Ubuntu14.04+win10雙系統破壞 還原

參考連結
https://www.linux.com/learn/how-rescue-non-booting-grub-2-linux
grub rescue> ls
(Hd0) (hd0,msdos4)

grub rescue> set prefix=(hd0,msdos4)/boot/grub
grub rescue> set root=(hd0,msdos4)
grub rescue> insmod normal
grub rescue> normal

========================
grub rescue> insmod linux
grub rescue> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1
grub rescue> initrd /boot/initrd.img-3.13.0-29-generic
grub rescue> boot

2016年7月29日 星期五

i2c沒問題版

#include <stdio.h>

#include <linux/types.h>

#include <stdlib.h>

#include <fcntl.h>

#include <unistd.h>

#include <sys/types.h>

#include <sys/ioctl.h>

#include <errno.h>

#include "delay.h"



#define I2C_RETRIES 0x0701

#define I2C_TIMEOUT 0x0702

#define I2C_RDWR 0x0707



#include <string.h>



#define STORAGE_DEV 0x56 /*Slave Device Address*/   //讀取位址是eeprom



struct i2c_msg {

    unsigned short addr;

    unsigned short flags;

    #define I2C_M_TEN 0x0010

    #define I2C_M_RD 0x0001

    unsigned short len;

    unsigned char *buf;

};



struct i2c_rdwr_ioctl_data{

    struct i2c_msg *msgs;

    int nmsgs;

};



struct i2c_rdwr_ioctl_data storage_data;

struct i2c_msg storage_msg[2];





int i2c_write(int fd, unsigned char slvAddr, unsigned char index, unsigned char * const data, unsigned char len )//將unsigned short index改為 unsigned char index

{

        int ret;

        unsigned char *tmp = (unsigned char*) malloc(1024);



        if (tmp == NULL) {

            perror("memory allocate error(write)!!");

            return -1;

        }



        memcpy(tmp, (unsigned char *)&index, sizeof(unsigned char));

//printf("tmp firtst memcpy=%d\n",tmp);
        memcpy((tmp + sizeof(unsigned char)), data, len);
//printf("tmp 2nd memcpy=%d\n",tmp);
        len += sizeof(unsigned char);



        /***write data to storage**/

        storage_data.nmsgs = 1;

        (storage_data.msgs[0]).len = len; // Data length

        (storage_data.msgs[0]).addr = slvAddr;//Device Addr

        (storage_data.msgs[0]).flags = 0; //write

        (storage_data.msgs[0]).buf = tmp;

        ret = ioctl(fd, I2C_RDWR, &storage_data);



        if (tmp)

          free(tmp);



        return (ret < 0) ? -1 : 0;

}



int i2c_read(int fd, unsigned char slvAddr, unsigned short index, unsigned char *data, int len)

{

        storage_data.nmsgs = 2;

        (storage_data.msgs[0]).len = sizeof(unsigned short);

        (storage_data.msgs[0]).addr = slvAddr;

        (storage_data.msgs[0]).flags = 0;  //Dummy write

        (storage_data.msgs[0]).buf = (unsigned char *)&index;

     

        (storage_data.msgs[1]).len = len;

        (storage_data.msgs[1]).addr = slvAddr;

        (storage_data.msgs[1]).flags = 1;

        (storage_data.msgs[1]).buf = data;



        if(ioctl(fd,I2C_RDWR, &storage_data) < 0){

            perror("ioctl error");

                return -1;

        }



        return 0;

}



int

i2c_transmit_data(int fd, unsigned char *data_ptr, unsigned char start_word_address ,unsigned char write_data_length)

{

        int i, ret = 0;

        unsigned char write_data_buffer[1024];    

        unsigned char transmit_legth = 4; //限制寫入的單位



        memset(write_data_buffer, 0, 1024);

        write_data_length = ((write_data_length > 1024) ? 1024 : write_data_length);

        memcpy(write_data_buffer, data_ptr, write_data_length);
//printf("write_data_buffer=%s\n",write_data_buffer);


        for (i = 0; i < write_data_length; i ++) {

                if ((i % transmit_legth) == 0) {

                        int retry = 5;

                        do {

                                ret = i2c_write(fd, STORAGE_DEV, (start_word_address + i), (write_data_buffer + i), transmit_legth);
//i2c_write(fd, 0x56, 0x47, tmp_buffer1, 1 );
                                if(ret == 0) {

                                        break;

                                }

                               mdelay(1);

                        } while (-- retry);



                        if (ret) {

                            printf("i2c write %i error!!!\n", i);

                        }

                }

        }

        return ret;

}



int

i2c_receive_data(int fd, unsigned char *data_ptr, unsigned short start_word_address ,unsigned short read_data_length)

{

        int i, ret = 0;

        unsigned char read_data_buffer[1024];      

        unsigned short receive_legth = 16;



        memset(read_data_buffer, 0x00, 1024);

        read_data_length = ((read_data_length > 1024) ? 1024 : read_data_length);



        for (i = 0; i < read_data_length; i ++) {

                if ((i % receive_legth) == 0) {

                        int retry = 5;

                        do {

                                ret = i2c_read(fd, STORAGE_DEV, (start_word_address + i), (read_data_buffer + i), receive_legth);

                                if(ret == 0) {

                                        break;

                                }

                               mdelay(1);

                        } while (-- retry);

                        if(ret == 0) {

#if 0

                                int count;

                                for (count = i; count < (i + receive_legth); count += 16) {

                                        printf("%d. [%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x]\n", count

                                                , read_data_buffer[count + 0]

                                                , read_data_buffer[count + 1]

                                                , read_data_buffer[count + 2]

                                                , read_data_buffer[count + 3]

                                                , read_data_buffer[count + 4]

                                                , read_data_buffer[count + 5]

                                                , read_data_buffer[count + 6]

                                                , read_data_buffer[count + 7]

                                                , read_data_buffer[count + 8]

                                                , read_data_buffer[count + 9]

                                                , read_data_buffer[count + 10]

                                                , read_data_buffer[count + 11]

                                                , read_data_buffer[count + 12]

                                                , read_data_buffer[count + 13]

                                                , read_data_buffer[count + 14]

                                                , read_data_buffer[count + 15]

                                        );

                                }

#endif

                        } else {

                            printf("i2c read %i error!!!\n", i);

                        }

                }

        }



        if (ret == 0) {

                memcpy(data_ptr, read_data_buffer, read_data_length);

        }



        return ret;

}



int str_isxdigit(char *tmp)

{

        int i;

        for (i = 0; i < strlen(tmp); i++) {

                if (!isxdigit(tmp[i]))

                        return -1;

        }

        return 0;

}



int str_isdigit(char *tmp)

{

        int i;

        for (i = 0; i < strlen(tmp); i++) {//strlen是擷取字元長度  s[] = "You may go farther and fare worse."長度為   printf("%d\n", strlen(s)); =====>34

                if (!isdigit(tmp[i])) //isdigit()判斷是否為數字還是字元,isdigit()為真是數字 isdigit()為假是字元

                        return -1;

        }

        return 0;

}



int main(int argc, char **argv)

{

        int fd = 0, ret = 0;

        int mode_type = 0; /*0: Read, 1: Write*/

        unsigned long test_value = 0;

        if ((argc == 3) && ((argv[1][0] == 'w') || (argv[1][0] == 'W'))) {   //&&是and   ||是or    ((argv[1][0] == 'w') || (argv[1][0] == 'W'))則一成立即可,與(argc == 3) 都必成立

                mode_type = 1;  /*0: Read, 1: Write*/

                if (str_isdigit(argv[2]) == 0) { //str_isdigit(argv[1])錯誤改為str_isdigit(argv[2])

                        if (str_isxdigit(argv[2]) == 0) {   //傳入值錯誤造成,且執行ret為真

                                sscanf(argv[2], "%lx", &test_value);

                                printf("test_value = %08lx\n", test_value);

                        } else {

                                ret = -1;

                        }

                } else {

                        ret = -1;

                }

        }

        else if ((argc == 2) && ((argv[1][0] == 'r') || (argv[1][0] == 'R'))) {

                mode_type = 0;  /*0: Read, 1: Write*/

        }

        else {

                ret = -1;

        }



        if (ret) {

                printf("%s r ==> Read Double Word.\n", argv[0]);

                printf("%s w 0x12345678 ==> Write Double Word.\n", argv[0]);

                return 0;

        }

     

        storage_data.nmsgs = 2;

        storage_data.msgs = storage_msg;



 printf("hello\n");

        fd = open("/dev/i2c-0",O_RDWR);

        if(fd < 0){

                perror("open I2C Dev error!!");

                exit(1);

        }

        ioctl(fd, I2C_TIMEOUT, 1);/*set timeout value*/

        ioctl(fd, I2C_RETRIES, 2);/*set retry times*/

#if 1

        if (mode_type == 1) /*0: Read, 1: Write*/

        {

                //I2C Write

                //Step 1. Transfer da16

                unsigned char write_api_cmd_buf[64]={

                /*Byte 0, Byte 1, Byte 2, Byte 3*/

                /*DW00*/       0x00, 0x00, 0x00, 0x00,

                };

                unsigned char i2c_data_length = 4;

               //memcpy((write_api_cmd_buf + (0 * 4)), &test_value, 4);  //<=====看不懂(write_api_cmd_buf + (0 * 4)) ==memcpy( write_api_cmd_buf , &test_value, 4);


  memcpy(write_api_cmd_buf + (0 * 4), &test_value, 4);
//memcpy(write_api_cmd_buf + (1 * 4), &test_value, 4); //實驗新增
//memcpy(write_api_cmd_buf + (2 * 4), &test_value, 4); //實驗新增
//memcpy(write_api_cmd_buf + (3 * 4), &test_value, 4); /實驗新增


//printf("write_api_cmd_buf=%s\n",write_api_cmd_buf);
//}




                i2c_transmit_data(fd, write_api_cmd_buf,0x00, i2c_data_length);

#if 0

                {

                        int i;

                        unsigned char tmp_buffer[1024];

                        memset(tmp_buffer, 0x00, 1024);

                        i2c_receive_data(fd, tmp_buffer, 0x0000, i2c_data_length);

                }

#endif

        }

#endif



#if 1

        if (mode_type == 0) /*0: Read, 1: Write*/

        {

                //test Read

                //Step 1. Receive data

                unsigned char write_api_cmd_buf[64]={

                /*Byte 0, Byte 1, Byte 2, Byte 3*/

                /*DW00*/       0x00, 0x00, 0x00, 0x00,

                };

                unsigned short i2c_data_length = 4;

                //i2c_transmit_data(fd, write_api_cmd_buf, 0x0000, i2c_data_length);

                {

                        int i, ret;

                        unsigned char tmp_buffer[64];    

                        memset(tmp_buffer, 0x00, 64);

                        ret = i2c_receive_data(fd, tmp_buffer, 0x0000, i2c_data_length);

                        if (ret == 0) {

                                printf("Data ==> 0x%08lX\n", *((unsigned long *)tmp_buffer + 0));

                        }

                }

        }

#endif



        if (fd)

                close(fd);



        return 0;

}

2016年7月27日 星期三

i2c讀取

#include <stdio.h>

#include <linux/types.h>

#include <stdlib.h>

#include <fcntl.h>

#include <unistd.h>

#include <sys/types.h>

#include <sys/ioctl.h>

#include <errno.h>

#include "delay.h"



#define I2C_RETRIES 0x0701

#define I2C_TIMEOUT 0x0702

#define I2C_RDWR 0x0707



#include <string.h>



#define STORAGE_DEV 0x56 /*Slave Device Address*/   //讀取位址是eeprom



struct i2c_msg {

    unsigned short addr;

    unsigned short flags;

    #define I2C_M_TEN 0x0010

    #define I2C_M_RD 0x0001

    unsigned short len;

    unsigned char *buf;

};



struct i2c_rdwr_ioctl_data{

    struct i2c_msg *msgs;

    int nmsgs;

};



struct i2c_rdwr_ioctl_data storage_data;

struct i2c_msg storage_msg[2];





int i2c_write(int fd, unsigned char slvAddr, unsigned short index, unsigned char * const data, unsigned char len )

{

        int ret;

        unsigned char *tmp = (unsigned char*) malloc(1024);



        if (tmp == NULL) {

            perror("memory allocate error(write)!!");

            return -1;

        }



        memcpy(tmp, (unsigned char *)&index, sizeof(unsigned short));

        memcpy((tmp + sizeof(unsigned short)), data, len);

        len += sizeof(unsigned short);



        /***write data to storage**/

        storage_data.nmsgs = 1;

        (storage_data.msgs[0]).len = len; // Data length

        (storage_data.msgs[0]).addr = slvAddr;//Device Addr

        (storage_data.msgs[0]).flags = 0; //write

        (storage_data.msgs[0]).buf = tmp;

        ret = ioctl(fd, I2C_RDWR, &storage_data);



        if (tmp)

          free(tmp);



        return (ret < 0) ? -1 : 0;

}



int i2c_read(int fd, unsigned char slvAddr, unsigned short index, unsigned char *data, int len)

{

        storage_data.nmsgs = 2;

        (storage_data.msgs[0]).len = sizeof(unsigned short);

        (storage_data.msgs[0]).addr = slvAddr;

        (storage_data.msgs[0]).flags = 0;  //Dummy write

        (storage_data.msgs[0]).buf = (unsigned char *)&index;

     

        (storage_data.msgs[1]).len = len;

        (storage_data.msgs[1]).addr = slvAddr;

        (storage_data.msgs[1]).flags = 1;

        (storage_data.msgs[1]).buf = data;



        if(ioctl(fd,I2C_RDWR, &storage_data) < 0){

            perror("ioctl error");

                return -1;

        }



        return 0;

}



int

i2c_transmit_data(int fd, unsigned char *data_ptr, unsigned short start_word_address ,unsigned short write_data_length)

{

        int i, ret = 0;

        unsigned char write_data_buffer[1024];    

        unsigned short transmit_legth = 16;



        memset(write_data_buffer, 0, 1024);

        write_data_length = ((write_data_length > 1024) ? 1024 : write_data_length);

        memcpy(write_data_buffer, data_ptr, write_data_length);



        for (i = 0; i < write_data_length; i ++) {

                if ((i % transmit_legth) == 0) {

                        int retry = 5;

                        do {

                                ret = i2c_write(fd, STORAGE_DEV, (start_word_address + i), (write_data_buffer + i), transmit_legth);
//i2c_write(fd, 0x56, 0x47, tmp_buffer1, 1 );
                                if(ret == 0) {

                                        break;

                                }

                               mdelay(1);

                        } while (-- retry);



                        if (ret) {

                            printf("i2c write %i error!!!\n", i);

                        }

                }

        }

        return ret;

}



int

i2c_receive_data(int fd, unsigned char *data_ptr, unsigned short start_word_address ,unsigned short read_data_length)

{

        int i, ret = 0;

        unsigned char read_data_buffer[1024];      

        unsigned short receive_legth = 16;



        memset(read_data_buffer, 0x00, 1024);

        read_data_length = ((read_data_length > 1024) ? 1024 : read_data_length);



        for (i = 0; i < read_data_length; i ++) {

                if ((i % receive_legth) == 0) {

                        int retry = 5;

                        do {

                                ret = i2c_read(fd, STORAGE_DEV, (start_word_address + i), (read_data_buffer + i), receive_legth);

                                if(ret == 0) {

                                        break;

                                }

                               mdelay(1);

                        } while (-- retry);

                        if(ret == 0) {

#if 0

                                int count;

                                for (count = i; count < (i + receive_legth); count += 16) {

                                        printf("%d. [%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x]\n", count

                                                , read_data_buffer[count + 0]

                                                , read_data_buffer[count + 1]

                                                , read_data_buffer[count + 2]

                                                , read_data_buffer[count + 3]

                                                , read_data_buffer[count + 4]

                                                , read_data_buffer[count + 5]

                                                , read_data_buffer[count + 6]

                                                , read_data_buffer[count + 7]

                                                , read_data_buffer[count + 8]

                                                , read_data_buffer[count + 9]

                                                , read_data_buffer[count + 10]

                                                , read_data_buffer[count + 11]

                                                , read_data_buffer[count + 12]

                                                , read_data_buffer[count + 13]

                                                , read_data_buffer[count + 14]

                                                , read_data_buffer[count + 15]

                                        );

                                }

#endif

                        } else {

                            printf("i2c read %i error!!!\n", i);

                        }

                }

        }



        if (ret == 0) {

                memcpy(data_ptr, read_data_buffer, read_data_length);

        }



        return ret;

}



int str_isxdigit(char *tmp)

{

        int i;

        for (i = 0; i < strlen(tmp); i++) {

                if (!isxdigit(tmp[i]))

                        return -1;

        }

        return 0;

}



int str_isdigit(char *tmp)

{

        int i;

        for (i = 0; i < strlen(tmp); i++) {//strlen是擷取字元長度  s[] = "You may go farther and fare worse."長度為   printf("%d\n", strlen(s)); =====>34

                if (!isdigit(tmp[i])) //isdigit()判斷是否為數字還是字元,isdigit()為真是數字 isdigit()為假是字元

                        return -1;

        }

        return 0;

}



int main(int argc, char **argv)

{

        int fd = 0, ret = 0;

        int mode_type = 0; /*0: Read, 1: Write*/

        unsigned long test_value = 0;

        if ((argc == 3) && ((argv[1][0] == 'w') || (argv[1][0] == 'W'))) {   //&&是and   ||是or    ((argv[1][0] == 'w') || (argv[1][0] == 'W'))則一成立即可,與(argc == 3) 都必成立

                mode_type = 1;  /*0: Read, 1: Write*/

                if (str_isdigit(argv[2]) == 0) { //str_isdigit(argv[1])錯誤改為str_isdigit(argv[2])

                        if (str_isxdigit(argv[2]) == 0) {   //傳入值錯誤造成,且執行ret為真

                                sscanf(argv[2], "%lx", &test_value);

                                printf("test_value = %08lx\n", test_value);

                        } else {

                                ret = -1;

                        }

                } else {

                        ret = -1;

                }

        }

        else if ((argc == 2) && ((argv[1][0] == 'r') || (argv[1][0] == 'R'))) {

                mode_type = 0;  /*0: Read, 1: Write*/

        }

        else {

                ret = -1;

        }



        if (ret) {

                printf("%s r ==> Read Double Word.\n", argv[0]);

                printf("%s w 0x12345678 ==> Write Double Word.\n", argv[0]);

                return 0;

        }

     

        storage_data.nmsgs = 2;

        storage_data.msgs = storage_msg;



 printf("hello\n");

        fd = open("/dev/i2c-0",O_RDWR);

        if(fd < 0){

                perror("open I2C Dev error!!");

                exit(1);

        }

        ioctl(fd, I2C_TIMEOUT, 1);/*set timeout value*/

        ioctl(fd, I2C_RETRIES, 2);/*set retry times*/

#if 1

        if (mode_type == 1) /*0: Read, 1: Write*/

        {

                //I2C Write

                //Step 1. Transfer data

                unsigned char write_api_cmd_buf[64]={

                /*Byte 0, Byte 1, Byte 2, Byte 3*/

                /*DW00*/       0x01, 0x00, 0x00, 0x00,

                };

                unsigned short i2c_data_length = 4;

               memcpy((write_api_cmd_buf + (0 * 4)), &test_value, 4);  //<=====看不懂(write_api_cmd_buf + (0 * 4))

   //memcpy(write_api_cmd_buf, &test_value, 4);

printf("write_api_cmd_buf=%s\n",write_api_cmd_buf);
                i2c_transmit_data(fd, write_api_cmd_buf,(0x0000), i2c_data_length);

#if 0

                {

                        int i;

                        unsigned char tmp_buffer[1024];

                        memset(tmp_buffer, 0x00, 1024);

                        i2c_receive_data(fd, tmp_buffer, 0x0000, i2c_data_length);

                }

#endif

        }

#endif



#if 1

        if (mode_type == 0) /*0: Read, 1: Write*/

        {

                //test Read

                //Step 1. Receive data

                unsigned char write_api_cmd_buf[64]={

                /*Byte 0, Byte 1, Byte 2, Byte 3*/

                /*DW00*/       0x00, 0x00, 0x00, 0x00,

                };

                unsigned short i2c_data_length = 4;

                //i2c_transmit_data(fd, write_api_cmd_buf, 0x0000, i2c_data_length);

                {

                        int i, ret;

                        unsigned char tmp_buffer[64];    

                        memset(tmp_buffer, 0x00, 64);

                        ret = i2c_receive_data(fd, tmp_buffer, 0x0000, i2c_data_length);

                        if (ret == 0) {

                                printf("Data ==> 0x%08lX\n", *((unsigned long *)tmp_buffer + 0));

                        }

                }

        }

#endif



        if (fd)

                close(fd);



        return 0;

}

2016年7月19日 星期二

10轉16進制

10轉16進制
http://forum.slime.com.tw/thread277654.html
#include<stdio.h>
#include<stdlib.h>


int main(void){
   int num,i,j,x;
   char s[999];
   //char str[999]; 這是多餘的
// while(scanf("%d",&num)!=EOF) 這行 scanf 沒有輸入提示,會搞到後面很難除錯
 while(1)
   {
    printf("\nInput DEC Number: "); // 增加的輸入提示
    scanf("%d",&num)!=EOF;
    j=0; // 把最下面的 j=0; 移上來比較容易了解作用: s 字串陣列 index 歸零  
    while (num!=0)
      {
       i=num%16; // 取餘數
       switch(i)
         {
          case 10:
            s[j]='a';
          break;
         
          case 11:
           s[j]='b';
          break;
         
          case 12:
            s[j]='c';
          break;
         
          case 13:
            s[j]='d';
          break;
         
          case 14:
            s[j]='e';
          break;  
         
          case 15:
            s[j]='f';
          break;
         
          default:
              // s[j]=i; 資料格式錯誤,必須要把數值格式轉換成 "文字格式"。
               s[j]=48+i; // 這一行是以 ASCII 編碼直接做換算。
         }
       num=num/16; //取商數,下一回的被除數
       j+=1;
      }
       s[j]='\0'; // 以據 C/C++ 語言的字串特性,給予的字串結尾符號。
     
      // j-=1; 可以直接並到 接下來的 for loop 中。

   printf("Otput HEX Number:["); // 增加的輸出顯示  
   //for (i=j;i>=0;i--)
   //   { printf("%s",s[i]); } 這是錯的,要顯示出字元,要用 %c 不然會錯誤,編譯後出現錯誤當機應該也是這裡  
 
   for (i=j-1;i>=0;i--)
      { printf("%c",s[i]); }

   printf("]");     // 增加的輸出顯示
   // j=0; 這行正確的作法,應該是要移到在上面的地方,需要明確的讓 s[j] 一開始規零的地方。
   printf("\n");
   }

 return 0;  
}