Linux Loop Device

losetup 으로 루프디바이스를 설정하면 파티션들이 보여야되는데 보이지 않는 문제 발견

http://askubuntu.com/questions/69363/mount-single-partition-from-image-of-entire-disk-device#673257

loop module max_part config
This is a decent method before 16.04.
loop is a kernel module, built into the kernel in Ubuntu 14.04.
If you configure it right, Linux automatically splits up the devices for you.
If you configure it right, Linux automatically splits up the devices for you.

cat /sys/module/loop/parameters/max_part

says how many partitions loop devices can generate.
It is 0 by default on Ubuntu 14.04 which is why no auto-splitting happens.
To change it, we can either add:

options loop max_part=31

to a file in /etc/modprobe, or:

GRUB_CMDLINE_LINUX="loop.max_part=31"

to /etc/default/grub and then sudo update-grub.
How to set a module parameter is also covered at: How to add kernel module parameters?
After a reboot, when you do:

sudo losetup -f --show my.img

it mounts the image to a /dev/loopX device, and automatically mounts the partitions to /dev/loopXpY devices.

의 해결책은 조금 귀찮으므로
https://lwn.net/Articles/274113/
에서 제시한  “modprobe loop max_part=63” 를 사용,

root@debian:~/z# ls /dev/loop0p*
/dev/loop0p1 /dev/loop0p2 /dev/loop0p3 /dev/loop0p4 /dev/loop0p5 /dev/loop0p6 /dev/loop0p7

잘된다

민원24 PDF 저장

nc -l -p 9100 > aa.pcl
./ghostpcl-9.20-linux-x86_64/gpcl6-920-linux_x86_64   -o aa.pdf -sDEVICE=pdfwrite aa.pcl

흠..  전엔 깔끔하게 텍스트 + 이미지로 저장됫던거 같은데 오늘 해보니 전부다 이미지로 저장됨

https://ghostscript.com/download/gpcldnld.html

 

—- 2017 02 26 추가

PCL의경우는 드라이버따라서 잘 안되는경우가 많은듯.
CP225W PS프린터 드라이버 설치 후
nc -l -p 9100 > aa.ps
ps2pdf aa.ps aa.pdf

 

 

—- 2023/11/03 추가

netcat이고 뭐고 그냥 프린트 실패시켜놓고 스풀가서 파일 땡기면 더간단해짐
C:\Windows\System32\spool\PRINTERS

GhostPCL 10.02.1 for Windows (64 bit)
@PJL ENTER LANGUAGE = PCLXL
.\gpcl6win64.exe -sDEVICE=pdfwrite -o out.pdf .\Desktop\00004.SPL

USB charging sepecs

 

  1. Standard downstream port (SDP) This is the same port defined by the USB 2.0 spec and is the typical form found in desktop and laptop computers. The maximum load current is 2.5mA when suspended, 100mA when connected and not suspended, and 500mA (max) when configured for that current. A device can recognize a SDP with hardware by detecting that the USB data lines, D+ and D-, are separately grounded through 15kΩ, but it still needs to enumerate to be USB compliant. In USB 2.0, it is not strictly legal to draw power without enumerating, although much of present-day hardware does just that, and in violation of the spec.
  2. Charging downstream port (CDP) BC1.1 defines this new, higher current USB port for PCs, laptops, and other hardware. Now the CDP can supply up to 1.5A, which is a departure from USB 2.0 because this current can be supplied before enumeration. A device plugged into a CDP can recognize it as such by means of a hardware handshake implemented by manipulating and monitoring the D+ and D- lines. (See USB Battery Charging Specification, section 3.2.3.) The hardware test takes place before turning the data lines over to the USB transceiver, thus allowing a CDP to be detected (and charging to begin) before enumeration.
  3. Dedicated charging port (DCP) BC1.1 describes power sources like wall warts and auto adapters that do not enumerate so that charging can occur with no digital communication at all. DCPs can supply up to 1.5A and are identified by a short between D+ to D-. This allows the creation of DCP “wall warts” that feature a USB mini or micro receptacle instead of a permanently attached wire with a barrel or customized connector. Such adapters allow any USB cable (with the correct plugs) to be used for charging.

 

http://www.usb.org/developers/docs/devclass_docs/USB_Battery_Charging_1.2.pdf

 

https://www.maximintegrated.com/en/app-notes/index.mvp/id/4803

stm8s103f3 communication with ssd1306 by using I2C

이거 별거 아닌데 ….
STM8S103F에서 I2C 드라이버 만들고
아두이노 라이브러리 보면서 SSD1306 컨트롤러 만들고
SSD1306 동작방법 이해하다 보니까 이거 하는데 꼬박 하루 쏟아부었다…
스크롤 기능도 있는거 같던데 필요하게되면 해봐야지

저거 이미지만 1k인데 stm8s103f 스펙이 4k… 보통 코드가 적당히 쓰면 2k정도 나오는데 이미지 두개 구겨넣으면 겨우 들어갈듯…

http://en.radzio.dxp.pl/bitmap_converter/
https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf
http://www.rinkydinkelectronics.com/r_fonts.php

근데 뭐하려고 만들었더라?!@….

20161205_000923