GM-Script-Writer-62850 / PHP-Scanner-Server

Allows you to use your Linux install as a web based scanner server thus allowing you to scan with any web enabled device; Now supports server side printing! (As of 1.4.11)
59 stars 17 forks source link

Variable name; bug or deliberate? #44

Closed kneiser closed 6 years ago

kneiser commented 6 years ago

I have an Epson Perfection V39 flatbed scanner that I have implemented on Scanner-Server successfully. When I first tried to get Scanner-Server to recognise my scanner it would not.

After following error and log messages I traced the problem to "index.php, line 1257":

$OURCE=($SOURCE=='Inactive')?'':"--source ".shell($SOURCE)." ";

I changed "$OURCE" to "$SOURCE", and Scanner-Server then recognized the scanner. Everything has been fine since.

Also in "PHP File: index.php, line 1263":

$cmd="scanimage -d $DEVICE $OURCE-l $X -t $Y -x $SIZE_X -y $SIZE_Y $DUPLEX--resolution $QUALITY --mode ".shell($MODE)." $LAMP--format=$RAW"; I changed it to “SOURCE” but scanner stopped working. I had to change back to “$OURCE”.

Please clarify if anything needs to be looked in to further. `

GM-Script-Writer-62850 commented 6 years ago

On the configure tab under scanners click on scanner list: http://127.0.0.1/index.php?page=Device%20Notes click on the 1st link under your scanner i need the output you get on that page to properly fix your issue

the line you changed is used to select the input tray on a scanner, for example some printers have a flatbed and a doc feeder, you are using a standalone scanner, so i assume it only has a flatbad If you changed line 1257 to $OURCE=''; it should have the same effect as what you did

kneiser commented 6 years ago

EPSON Epson_Perfection_V39

imagescan:esci:gt-s650:usb:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0
The 'Document Table' source supports
    A bay width of 8.6"
    A bay height of 11.8"
    A scanner resolution of 50 DPI to 4,800 DPI
    No duplex (double sided) scanning
    3 color modes
GM-Script-Writer-62850 commented 6 years ago

I need you to click the link starting with imagescan that page has what i need http://127.0.0.1/index.php?page=Device%20Notes&action=imagescan%3Aesci%3Agt-s650%3Ausb%3A%2Fsys%2Fdevices%2Fpci0000%3A00%2F0000%3A00%3A1d.7%2Fusb1%2F1-6%2F1-6%3A1.0 i could not give a direct link before as i did not know that very long link's text maybe there is a issue with a space in the source name? i am pretty sure it should support it

GM-Script-Writer-62850 commented 6 years ago

This command should put a scan on your desktop, does it not work? if not any error messages?

scanimage -d 'imagescan:esci:gt-s650:usb:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0' --source 'Document Table' -l 0 -t 0 -x 218.44 -y 299.72 --resolution 50 --mode 'Color' --format=pnm > ~/Desktop/Testscan_With_Source.pnm

the edit you did would have changed it to this:

scanimage -d 'imagescan:esci:gt-s650:usb:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0' -l 0 -t 0 -x 218.44 -y 299.72 --resolution 50 --mode 'Color' --format=pnm > ~/Desktop/Testscan_Without_Source.pnm
kneiser commented 6 years ago

Clicking on the link starting with imagescan : Link displayed: imagescan:esci:gt-s650:usb:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0 Results:

All options specific to device `imagescan:esci:gt-s650:usb:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0':
  General:
    --source Document Table [Document Table] [read-only]
        Document Source
    --enable-resampling[=(yes|no)] [inactive]
        This option provides the user with a wider range of supported
        resolutions.  Resolutions not supported by the hardware will be
        achieved through image processing methods.
    --resolution 50..4800dpi [300]
        Resolution
    --scan-area Executive/Portrait|ISO/A4/Portrait|ISO/A5/Portrait|ISO/A5/Landscape|ISO/A6/Portrait|ISO/A6/Landscape|JIS/B5/Portrait|JIS/B6/Portrait|JIS/B6/Landscape|Letter/Portrait|Manual|Maximum [Manual]
        Scan Area
    --mode Monochrome|Grayscale|Color [Color]
        Image Type
  Geometry:
    -x 2.53999..218.44mm [215.9]
        Width of scan-area.
    -y 2.53999..299.72mm [297.18]
        Height of scan-area.
    -l 0..215.9mm [0]
        Top Left X
    -t 0..297.18mm [0]
        Top Left Y
  Enhancement:
    --rotate 0 degrees|90 degrees|180 degrees|270 degrees|Auto [0 degrees]
        Rotate
    --blank-threshold 0..100 [0]
        Skip Blank Pages Settings
    --brightness -100..100 [0]
        Change brightness of the acquired image.
    --contrast -100..100 [0]
        Change contrast of the acquired image.
    --threshold 0..255 [128]
        Threshold
  Other:
    --cct-1  [1.0824]
    --cct-2  [0.00849915]
    --cct-3  [-0.0908966]
    --cct-4  [0.0338898]
    --cct-5  [1.10429]
    --cct-6  [-0.138199]
    --cct-7  [0.00869751]
    --cct-8  [-0.155685]
    --cct-9  [1.14699]
    --gamma 1.0|1.8 [1.8]
        Gamma
    --line-count 0..255 [0]
        Specify how many scan lines to move from the device to the software in
        one transfer.  Note that 0 will use the maximum usable value.  Values
        larger than the maximum usable value are clamped to the maximum.
    --speed[=(yes|no)] [no]
        Speed
    --sw-color-correction[=(yes|no)] [yes]
    --transfer-format RAW [RAW] [read-only]
        Transfer Format
kneiser commented 6 years ago

Command line: I changed to the Downloads directory as this is a LAMP server.

scanimage -d 'imagescan:esci:gt-s650:usb:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0' --source 'Document Table' -l 0 -t 0 -x 218.44 -y 299.72 --resolution 50 --mode 'Color' --format=pnm > ~/Downloads/Testscan_With_Source.pnm

Errror Displayed: scanimage: unrecognized option '--source'

scanimage -d 'imagescan:esci:gt-s650:usb:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0' -l 0 -t 0 -x 218.44 -y 299.72 --resolution 50 --mode 'Color' --format=pnm > ~/Downloads/Testscan_Without_Source.pnm

Error Displayed: scanimage: setting of option --br-x failed (Invalid argument)

GM-Script-Writer-62850 commented 6 years ago

Your scanners geometry seems strange, I would expect the max value for -t and -y to be the same and -x and -l to be the same

Could you post your config/scanners.json file's content?

GM-Script-Writer-62850 commented 6 years ago

This may not give the --br-x error: With source:

scanimage -d 'imagescan:esci:gt-s650:usb:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0' --source 'Document Table' -l 0 -t 0 -x 215.9 -y 279.4 --resolution 50 --mode 'Color' --format=pnm > ~/Downloads/Testscan_With_Source.pnm

Without Source

scanimage -d 'imagescan:esci:gt-s650:usb:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0' -l 0 -t 0 -x 215.9 -y 279.4 --resolution 50 --mode 'Color' --format=pnm > ~/Downloads/Testscan_Without_Source.png

Assuming without source works all i should need to do is check for [read only] on the source line and if found treat it as inactive

kneiser commented 6 years ago

scanners.json:

[{
    "ID": 0,
    "INUSE": 0,
    "DEVICE": "imagescan:esci:gt-s650:usb:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0",
    "NAME": "EPSON Epson_Perfection_V39 ",
    "SOURCE": "Document Table",
    "DPI-Document Table": "50|100|200|300|400|500|600|700|800|900|1000|1100|1200|1300|1400|1500|1600|1700|1800|1900|2000|2100|2200|2300|2400|2500|2600|2700|2800|2900|3000|3100|3200|3300|3400|3500|3600|3700|3800|3900|4000|4100|4200|4300|4400|4500|4600|4700|4800",
    "DUPLEX-Document Table": false,
    "MODE-Document Table": "Monochrome|Grayscale|Color",
    "WIDTH-Document Table": 218.44,
    "HEIGHT-Document Table": 299.72,
    "UUID": null,
    "SELECTED": 1
}]
kneiser commented 6 years ago

With source:

Error Displayed: scanimage: unrecognized option '--source'

Without source:

Works fine!

GM-Script-Writer-62850 commented 6 years ago

This should solve it: Commit #1e8d6cb (Only changes to index.php apply to this)

GM-Script-Writer-62850 commented 6 years ago

*You need to re scan for scanners after making that change

kneiser commented 6 years ago

Ok that did the trick! Thanx!