Showing posts with label Linux.Developer. Show all posts
Showing posts with label Linux.Developer. Show all posts

Thursday, October 21, 2021

Linux check input ports

 $ sudo cat /proc/ioports

0000-0cf7 : PCI Bus 0000:00
 0000-001f : dma1
 0020-0021 : pic1
 0040-0043 : timer0
 0050-0053 : timer1
 0060-0060 : keyboard
 0061-0061 : PNP0800:00
 0064-0064 : keyboard
 0070-0071 : rtc0
 0080-008f : dma page reg
 00a0-00a1 : pic2
 00c0-00df : dma2
 00f0-00ff : PNP0C04:00
   00f0-00ff : fpu
 0290-0297 : pnp 00:03
 0378-037a : parport0
 037b-037f : parport0
 03c0-03df : vesafb
 03f8-03ff : serial
 0400-041f : 0000:00:1f.3
 04d0-04d1 : pnp 00:04
 0500-053f : 0000:00:1f.0
 0778-077a : parport0
 0800-087f : 0000:00:1f.0
   0800-087f : pnp 00:04
     0800-0803 : ACPI PM1a_EVT_BLK
     0804-0805 : ACPI PM1a_CNT_BLK
     0808-080b : ACPI PM_TMR
     0820-082f : ACPI GPE0_BLK
     0830-0833 : iTCO_wdt.0.auto
     0850-0850 : ACPI PM2_CNT_BLK
     0860-087f : iTCO_wdt.0.auto
0cf8-0cff : PCI conf1
0d00-ffff : PCI Bus 0000:00
 1000-1fff : PCI Bus 0000:05
 2000-2fff : PCI Bus 0000:04

$ cat /proc/bus/input/devices

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=PNP0C0C/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0
U: Uniq=
H: Handlers=kbd event0  
B: PROP=0
B: EV=3
B: KEY=10000000000000 0

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=LNXPWRBN/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXPWRBN:00/input/input1
U: Uniq=
H: Handlers=kbd event1  
B: PROP=0
B: EV=3
B: KEY=10000000000000 0

I: Bus=0003 Vendor=046d Product=c016 Version=0110
N: Name="Logitech Optical USB Mouse"
P: Phys=usb-0000:00:1d.0-1/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/0003:046D:C016.0001/i
nput/input5
U: Uniq=
H: Handlers=mouse0 event2  
B: PROP=0
B: EV=17
B: KEY=70000 0 0 0 0
B: REL=103
B: MSC=10

I: Bus=0003 Vendor=045e Product=0750 Version=0111
N: Name="Microsoft Wired Keyboard 600"
P: Phys=usb-0000:00:1d.0-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.0/0003:045E:0750.0002/i
nput/input6
U: Uniq=
H: Handlers=sysrq kbd event3 leds  
B: PROP=0
B: EV=120013
B: KEY=1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7

I: Bus=0003 Vendor=045e Product=0750 Version=0111
N: Name="Microsoft Wired Keyboard 600"
P: Phys=usb-0000:00:1d.0-2/input1
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.1/0003:045E:0750.0003/i
nput/input7
U: Uniq=
H: Handlers=sysrq kbd event4  
B: PROP=0
B: EV=10001f
B: KEY=3f0003007f 0 0 4c3ffff17aff32d bf54445600000000 1 130f938b17c007 ffff7bfa
d971dfff febeffdfffefffff fffffffffffffffe
B: REL=40
B: ABS=10100000000
B: MSC=10

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel Front Mic"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input8
U: Uniq=
H: Handlers=event5  
B: PROP=0
B: EV=21
B: SW=10


$sudo cat /dev/input/event3 #test if it's working



Tuesday, October 05, 2021

Processing mp3 by Python3 in Linux

 

 

$ sudo apt install llvm-8
 

$ locate llvm-config

$ LLVM_CONFIG=/usr/bin/llvm-config-8 pip3 install librosa --user
 

 

packages: llvmlite, numba, soundfile, resampy, audioread, librosa


 

Thursday, July 01, 2021

Images to PDF file (case study)

0. Previous requeriments

$sudo apt install img2pdf
$sudo apt install ocrmypdf

1. Download images by script

for n in `seq 1 23`
do
  sn=`printf "%02d" $n`
  echo $sn
  wget https://larepublica.cronosmedia.glr.pe/printed/2021/07/01/lima/pages/$sn.jpeg
done
 

2. Convert images to pdf (after executed download script by sh)

$img2pdf *.jpeg --output rep1.pdf #or

$convert *.jpeg rep2.pdf

$ocrmypdf rep1.pdf rep1_ocr.pdf #reduce size

 

Notes for convert command(change from none to read|write):

sudo vim /etc/ImageMagick-6/policy.xml

<policy domain="coder" rights="none" pattern="PDF" />

<policy domain="coder" rights="read|write" pattern="PDF" />
 
 
Bonus
[1] El Pueblo news url https://www.diarioelpueblo.com.pe/wp-content/uploads/2021/07/01-07-2021.pdf
 

Monday, June 21, 2021

Python Settings to use in environments

Solving multiple python instalation:
 
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
sudo update-alternatives --config python3
  

Solving:

Error: Command '['/home/DRIVE/Temp/aa/bin/python3.9', '-Im', 'ensurepip', '--upg
rade', '--default-pip']' returned non-zero exit status 1.
 

apt-get install python3.6-dev python3.6-venv
python3.6 -m venv myVenv 

Upgrade pip

pip3 install --upgrade pip
 

 

Monday, March 15, 2021

Cuda on Linux18 (y2021)

After installation don't forget it(.bashrc):

#Cuda 8.0 Settings
export CUDA_HOME=/usr/local/cuda-8.0
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64  
PATH=${CUDA_HOME}/bin:${PATH}
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:

 

Drivers

[1] Legacy https://www.nvidia.com/en-us/drivers/unix/

To Review (Cuda and Driver)

CUDA 11.2             >= 450.80.02
CUDA 11.1 (11.1.0)     >= 450.80.02
CUDA 11.0 (11.0.3)     >= 450.36.06
CUDA 10.2 (10.2.89)     >= 440.33
CUDA 10.1 (10.1.105)     >= 418.39
CUDA 10.0 (10.0.130)     >= 410.48
CUDA 9.2 (9.2.88)     >= 396.26
CUDA 9.1 (9.1.85)     >= 390.46
CUDA 9.0 (9.0.76)     >= 384.81
CUDA 8.0 (8.0.61 GA2)     >= 375.26
CUDA 8.0 (8.0.44)     >= 367.48
CUDA 7.5 (7.5.16)     >= 352.31
CUDA 7.0 (7.0.28)     >= 346.46

[1] Compatibility  https://docs.nvidia.com/deploy/cuda-compatibility/index.html 

To Review (Cuda and GCC)

CUDA version     Max GCC version
11.1             10.0
11                9
10.1, 10.2    8
9.2, 10.0      7
9.0, 9.1        6
8                  5.3
7                  4.9
5.5, 6           4.8
4.2, 5           4.6
4.1               4.5
4.0               4.4

Cuda Toolkit from 6.5 to 10 and more

[1] https://developer.nvidia.com/cuda-toolkit-archive

Common problems

[1] Can't locate InstallUtils.pm in @INC

$sh ./cuda(your version).run --tar mxvf #for unpack

$cp InstallUtils.pm /usr/lib/x86_64-linux-gnu/perl-base #check path in error message

[2] Messages during Cuda installation

$sudo ./cuda_6.5.14_linux_64.run --override

$sudo ./cuda_xxx.run --override  #to ignore last compiler or related

#During Cuda 6.5

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 340.29?

#During Cuda 8

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26?

#During Cuda 9

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?

[3] Adicional  notes

https://forums.dual.sphysics.org/discussion/1324/get-the-gpu-running


[4] How to disable nouveau driver to install NVIDIA drivers

$vi /etc/modprobe.d/blacklist-nvidia-nouveau.conf
blacklist nouveau
options nouveau modeset=0
$sudo update-initramfs -u 
$sudo reboot 

 

 

Friday, December 18, 2020

Houdini 18 : Parse .bgeo files

 

$hython /opt/hfs18.0.460/houdini/public/hgeo/hgeo.py file.bgeo

       7199 Points
       7199 Vertices
          1 Primitives
----- Attributes -----
Point Attributes
   numeric P[3]
   numeric v[3]
Primitive Attributes
   string name[1]
Global Attributes
   numeric rest_ratio[1]
   numeric rest2_ratio[1]
   numeric timescale[1]
1 Primitives
         1 PolySoup
Primitive 0 is a PolySoup and has 0 vertices.

 

$ hython /opt/hfs18.0.460/houdini/public/binary_json/json_binary_verify.py /opt
/hfs18.0.460/houdini/geo/defgeo.bgeo  
JSON Valid: /opt/hfs18.0.460/houdini/geo/defgeo.bgeo (0.002985 s)

 

Monday, November 02, 2020

Compile g3dviewer in Ubuntu16

 

Source:

[1] http://automagically.de/g3dviewer/


Settings:

$cd src

$grep DATA_DIR *
$locate g3dviewer.glade #to define DATA_DIR

#To find right libraries

$pkg-config --libs gtk+-2.0     
$pkg-config --libs gtkglext-x11-1.0

 

Compile Code:

$gcc -o app main.c model.c screenshot.c texture.c trackball.c glarea.c gl.c gu
i_callbacks.c gui_glade.c gui_infowin.c gui_log.c -I /usr/include/gtk-2.0 -I /u
sr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/inclu
de/cairo -I /usr/include/pango-1.0 -I /usr/lib/x86_64-linux-gnu/gtk-2.0/include
-I /usr/include/gdk-pixbuf-2.0 -I /usr/include/atk-1.0 -I /usr/include/gtkglex
t-1.0 -I /usr/lib/gtkglext-1.0/include -I /usr/include/libglade-2.0 -lgtk-x11-2
.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0
-lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lm
-lGL -lglut -lGLU -lglade-2.0 -lgtkglext-x11-1.0 -lgdkglext-x11-1.0 -lGLU -lGL
-lXmu -lXt -lSM -lICE -lgdk-x11-2.0 -lpangox-1.0 -lX11 -Wl,--export-dynamic -l
gmodule-2.0 -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lc
airo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib
-2.0 -lfontconfig -lfreetype -lg3d


 


Friday, October 30, 2020

Compile k3d in Ubuntu 16

 

Logo

Source http://www.k-3d.org/

Main errors:

INCLUDE(K3DFindFreetype2) # freetype6-dev

INCLUDE(K3DFindGtkmm) #DEBUG 

https://gtkmm.org/en/download.html #works with version 2.x

INCLUDE(K3DFindFTGL) #DEBUG

#To DEBUG Variables

message(STATUS "DEBUG: K3D_FREETYPE2_FOUND: ${K3D_FREETYPE2_FOUND}")
message(STATUS "DEBUG: Aqsis_FOUND: ${Aqsis_FOUND}")

#Support CUDA need to enable in CMakeLists.txt (main)

Day 2:

K3DFindBoost.cmake (update paths)

SET(K3D_BOOST_INCLUDE_DIR "/usr/local/include" CACHE PATH "Override the default location for Boost header files.")
SET(K3D_BOOST_LIBRARY_DIR "/usr/local/lib" CACHE PATH "Override the default location for Boost libraries.")


renderframe/CMakeLists.txt

LINK_DIRECTORIES() #add boost path

TARGET_LINK_LIBRARIES()  #add boost_regex boost_program_options boost_system boost_python27 boost_thread boost_date_time

 #disable CGAL

#K3D_CHECK(K3D_BUILD_CGAL_MODULE REQUIRES K3D_CGAL_FOUND RESOURCE "CGAL") #DEBUG


 

Thursday, October 29, 2020

Saturday, October 24, 2020

Compile and Links snippets

 

 

[1] cmake parameters https://stackoverflow.com/questions/31387188/pass-variable-value-to-make-using-cmake

 

[2] PYTHONPATH https://www.devdungeon.com/content/python-import-syspath-and-pythonpath-tutorial

 

Wednesday, October 21, 2020

Boost 1.7 on Ubuntu16

 

 

https://www.boost.org/users/download/


Enable to work with Python3


cd boost1.7
 $./bootstrap.sh -with-libraries=python -with-python-version=3.6 
$./b2
$sudo ./b2 install

Wednesday, March 25, 2020

Local port to public access


[0] serveo
[1] ngrok https://dashboard.ngrok.com

Alternatives
[1] ngrok alternatives and comparison https://www.softwaretestinghelp.com/ngrok-alternatives/

[2] https://www.reddit.com/r/webdev/comments/ca634r/alternatives_to_serveo_for_localhost_tunneling/

Monday, March 09, 2020

cmake force g++ gcc version to use



$cmake -DCMAKE_CXX_COMPILER=g++-8  -DCMAKE_CC_COMPILER=gcc-8 ..

This command affec to next variables into CMakeLists.txt file
CMAKE_CXX_COMPILER_VERSION
CMAKE_CXX_COMPILER_ID


#Next lines doesn't works for me on this time.

set(CMAKE_C_COMPILER /usr/bin/gcc-8)
set(CMAKE_CXX_COMPILER /usr/bin/g++-8)

Thursday, December 12, 2019

Fedora mySql



fix Table 'information_schema.SCHEMATA' doesn't exist

$sudo mysql_upgrade -u root -p --force

Thursday, November 21, 2019

Linux System Information



Find if your Linux is 64 bit is by using:

$getconf LONG_BIT

`uname -m` tells only about the kernel, the userspace and distro can be still 32-bit. Similarly `lscpu` only tells what the CPU is capable of, not if OS, kernel and distro are 32 or 64 bit.
 
 
$file /lib/systemd/systemd
$lscpu
$uname -i
$uname -m 
$dpkg --print-architecture
 

Saturday, October 26, 2019

Vulkan Resources


[1] Vulkan-sdk https://www.lunarg.com/vulkan-sdk/
[2] Download https://vulkan.lunarg.com/
[3] Document
https://vulkan.lunarg.com/doc/view/1.1.101.0/linux/getting_started.html
https://vulkan.lunarg.com/doc/view/1.1.70.1/linux/getting_started.html
[4] C++ binding https://github.com/KhronosGroup/Vulkan-Hpp

[5] Examples https://github.com/SaschaWillems/Vulkan

[] gli, C++ image library. Works with OpenGL or Vulkan https://github.com/g-truc/gli

Running apps

Runtastic (I uninstalled because force to update your device - Internet connection problems) Runkeeper  (Currently testing) Strava   (Curre...