Small fix for buffer address in ftdi_write_data. Added some error checks
git-svn-id: svn://kolibrios.org@5042 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
bf60efb41b
commit
009c3b7c15
@ -48,7 +48,6 @@ HID_DESCR_TYPE = 21h
|
|||||||
REPORT_DESCR_TYPE = 22h
|
REPORT_DESCR_TYPE = 22h
|
||||||
PHYSICAL_DESCR_TYPE = 23h
|
PHYSICAL_DESCR_TYPE = 23h
|
||||||
|
|
||||||
|
|
||||||
; LibUSB constatnts
|
; LibUSB constatnts
|
||||||
LIBUSB_REQUEST_TYPE_STANDARD = (0x00 shl 5)
|
LIBUSB_REQUEST_TYPE_STANDARD = (0x00 shl 5)
|
||||||
LIBUSB_REQUEST_TYPE_CLASS = (0x01 shl 5)
|
LIBUSB_REQUEST_TYPE_CLASS = (0x01 shl 5)
|
||||||
@ -292,7 +291,7 @@ out_size equ IOCTL.out_size
|
|||||||
align 4
|
align 4
|
||||||
proc service_proc stdcall uses ebx esi edi, ioctl:DWORD
|
proc service_proc stdcall uses ebx esi edi, ioctl:DWORD
|
||||||
locals
|
locals
|
||||||
ConfPacket rb 8
|
ConfPacket rb 10
|
||||||
EventData rd 3
|
EventData rd 3
|
||||||
endl
|
endl
|
||||||
mov edi, [ioctl]
|
mov edi, [ioctl]
|
||||||
@ -396,9 +395,10 @@ endl
|
|||||||
.version:
|
.version:
|
||||||
jmp .endswitch
|
jmp .endswitch
|
||||||
.error:
|
.error:
|
||||||
mov esi, [edi+output]
|
DEBUGF 1, 'K : FTDI error occured! %d\n', eax
|
||||||
mov [esi], dword 'ERR0'
|
;mov esi, [edi+output]
|
||||||
or [esi], eax
|
;mov [esi], dword 'ERR0'
|
||||||
|
;or [esi], eax
|
||||||
ret
|
ret
|
||||||
.endswitch:
|
.endswitch:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@ -437,7 +437,10 @@ endl
|
|||||||
mov eax, [EventData]
|
mov eax, [EventData]
|
||||||
mov ebx, [EventData+4]
|
mov ebx, [EventData+4]
|
||||||
call WaitEvent
|
call WaitEvent
|
||||||
jmp .endswitch
|
mov eax, [EventData+8]
|
||||||
|
test eax, eax
|
||||||
|
jz .endswitch
|
||||||
|
jmp .error
|
||||||
|
|
||||||
.ftdi_setrtshigh:
|
.ftdi_setrtshigh:
|
||||||
;DEBUGF 1,'K : FTDI Setting RTS pin HIGH\n'
|
;DEBUGF 1,'K : FTDI Setting RTS pin HIGH\n'
|
||||||
@ -503,20 +506,29 @@ endl
|
|||||||
jmp .own_index
|
jmp .own_index
|
||||||
|
|
||||||
.ftdi_read_pins:
|
.ftdi_read_pins:
|
||||||
mov ebx, [edi]
|
mov ebx, [edi+4]
|
||||||
mov dword[ConfPacket], FTDI_DEVICE_IN_REQTYPE + (SIO_READ_PINS_REQUEST shl 8) + (0 shl 16)
|
mov dword[ConfPacket], FTDI_DEVICE_IN_REQTYPE + (SIO_READ_PINS_REQUEST shl 8) + (0 shl 16)
|
||||||
mov ecx, [ebx + ftdi_context.index]
|
mov ecx, [ebx + ftdi_context.index]
|
||||||
mov word[ConfPacket+4], cx
|
mov word[ConfPacket+4], cx
|
||||||
mov word[ConfPacket+6], 1
|
mov word[ConfPacket+6], 1
|
||||||
lea esi, [ConfPacket]
|
lea esi, [ConfPacket]
|
||||||
lea edi, [EventData]
|
lea edi, [EventData]
|
||||||
mov ecx, [ioctl]
|
mov ecx, esi
|
||||||
mov ecx, [ecx+output]
|
add ecx, 8
|
||||||
|
mov word[ConfPacket+8], 0
|
||||||
stdcall USBControlTransferAsync, [ebx + ftdi_context.nullP], esi, ecx, 1, control_callback, edi, 0
|
stdcall USBControlTransferAsync, [ebx + ftdi_context.nullP], esi, ecx, 1, control_callback, edi, 0
|
||||||
mov eax, [EventData]
|
mov eax, [EventData]
|
||||||
mov ebx, [EventData+4]
|
mov ebx, [EventData+4]
|
||||||
call WaitEvent
|
call WaitEvent
|
||||||
jmp .endswitch
|
xor ebx, ebx
|
||||||
|
mov bx, word[ConfPacket+8]
|
||||||
|
mov ecx, [ioctl]
|
||||||
|
mov ecx, [ecx+output]
|
||||||
|
mov [ecx], ebx
|
||||||
|
mov eax, [EventData+8]
|
||||||
|
test eax, eax
|
||||||
|
jz .endswitch
|
||||||
|
jmp .error
|
||||||
|
|
||||||
.ftdi_set_wchunksize:
|
.ftdi_set_wchunksize:
|
||||||
mov ebx, [edi+4]
|
mov ebx, [edi+4]
|
||||||
@ -565,10 +577,11 @@ endl
|
|||||||
@@:
|
@@:
|
||||||
mov dword[ConfPacket], eax
|
mov dword[ConfPacket], eax
|
||||||
mov ecx, [edi+8]
|
mov ecx, [edi+8]
|
||||||
push edi esi
|
push edi
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
rep movsb
|
rep movsb
|
||||||
pop esi edi
|
pop edi
|
||||||
|
mov esi, dword[ConfPacket]
|
||||||
;---Dirty hack end
|
;---Dirty hack end
|
||||||
xor ecx, ecx ; ecx - offset
|
xor ecx, ecx ; ecx - offset
|
||||||
.write_loop:
|
.write_loop:
|
||||||
@ -585,9 +598,6 @@ endl
|
|||||||
mov eax, [EventData]
|
mov eax, [EventData]
|
||||||
mov ebx, [EventData+4]
|
mov ebx, [EventData+4]
|
||||||
call WaitEvent
|
call WaitEvent
|
||||||
mov eax, [EventData]
|
|
||||||
mov ebx, [EventData+4]
|
|
||||||
call ClearEvent
|
|
||||||
pop edi esi ebx ecx
|
pop edi esi ebx ecx
|
||||||
cmp [EventData+8], -1
|
cmp [EventData+8], -1
|
||||||
jz .error
|
jz .error
|
||||||
@ -635,9 +645,6 @@ endl
|
|||||||
mov eax, [EventData]
|
mov eax, [EventData]
|
||||||
mov ebx, [EventData+4]
|
mov ebx, [EventData+4]
|
||||||
call WaitEvent
|
call WaitEvent
|
||||||
mov eax, [EventData]
|
|
||||||
mov ebx, [EventData+4]
|
|
||||||
call ClearEvent
|
|
||||||
pop ebx ecx edi esi
|
pop ebx ecx edi esi
|
||||||
cmp [EventData+8], -1
|
cmp [EventData+8], -1
|
||||||
jz .error
|
jz .error
|
||||||
|
Loading…
Reference in New Issue
Block a user