Selaa lähdekoodia

docs: update README.md

v0lp3 4 vuotta sitten
vanhempi
commit
72ca24666a
1 muutettua tiedostoa jossa 67 lisäystä ja 5 poistoa
  1. 67 5
      README.md

+ 67 - 5
README.md

@@ -2,13 +2,77 @@
 
 ## Reasons
 
-Brother MFC-J430W has already scanner driver and you can download [here](https://support.brother.com/g/b/downloadtop.aspx?c=it&lang=it&prod=mfcj430w_all) but that are prebuilt binary (x86/x64) and source code isn't public. My problem was that I wanted use scanner in my RPi4 but those driver not works on ARM architecture. In the end I solved this issue throught workaround using a vps... recently I resumed the project and I found a solution (partially thanks to [this](https://github.com/davidar/mfc7400c/)) and imho I think this is better than any workaround.
+_Brother MFC-J430W has already scanner driver and you can download [here](https://support.brother.com/g/b/downloadtop.aspx?c=it&lang=it&prod=mfcj430w_all)_ **but that are prebuilt binary (x86/x64) and source code isn't public**. My problem was that I wanted use scanner in my RPi4 but **those driver not works on ARM architecture**. In the end I solved this issue throught workaround using a vps... recently I resumed the project and I found a solution (partially thanks to [this](https://github.com/davidar/mfc7400c/)) and imho I think this is better than any workaround. I think that this should work on every scanner that use **brscan4**
 
 ## Scanner protocol
 
 ![protocol](./docs/protocol.png)
 
-Documentation work in progress....
+### Status code
+
+When we open a connection with the scanner on port 54921, it respond with his status code:
+
+- **+OK 200**: Ready to use
+- **-401**: Scanner is busy
+
+### Leasing
+
+Now we can send a request that specify resolution and color mode, then scanner send to client a offer based on request.
+
+Request:
+
+```go
+request := []byte(fmt.Sprintf("\x1bI\nR=300,300\nM=GRAY64\n\x80", resolution, resolution, mode))
+sendPacket(socket, request)
+```
+
+Response:
+
+`300,300,2,209,2480,294,3472`
+
+- `response[0]` `response[1]`: Resolution
+- `response[3]` `response[5]`: Dimensions in mm
+- `response[4]` `response[6]`: Dimensions in px
+- `response[2]`: ?
+
+**Color mode are**:
+
+- **GRAY64**: gray scale image
+- **CGRAY**: color image
+
+Resolution are **100, 150, 300, 600, 1200, 2400**.
+I called this part `leasing` because it recalled me _DHCP leasing_
+
+### Automatic document feeder
+
+If specified it's possible to disable ADF and scan only one page.
+Omit this if you want use ADF.
+
+```go
+if !adf {
+  request = []byte("\x1bD\nADF\n\x80")
+  sendPacket(socket, request)
+  readPacket(socket)
+}
+```
+
+## Start scan
+
+Now we are ready to send start scan request:
+
+```go
+requestFormat := "\x1bX\nR=%v,%v\nM=%s\nC=%s\nJ=MID\nB=50\nN=50\nA=0,0,%v,%v\n\x80"
+```
+
+- **R** = `X_RES`, `Y_WIDTH`
+- **M** = `CGRAY` or `GRAY64`
+- **C** = `JPEG` or `RLENGTH` or `NONE`
+- **J** = MID
+- **B** = 50 (Brightness?)
+- **N** = 50 (Contrast?)
+- **A** = 0,0,`WIDTH`, `HEIGHT`
+
+Documentation work in progress...
 
 ## Compile
 
@@ -40,7 +104,5 @@ Usage of ./mfc-j430w:
 
 ## To do
 
-- [ ] Integrate with SANE
 - [ ] Implement multi page scan for ADF
-- [ ] Add flag to output compressed image
-- [ ] Add flag to customize brightness and contrast
+- [ ] Add flag to output compressed image