Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement #68 #69

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/ccid_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,16 @@ static int get_end_points(struct libusb_config_descriptor *desc,
} /* get_end_points */


#if !defined(TWIN_SERIAL)
EXTERNAL uint8_t get_ccid_usb_bus_number(int reader_index) {
return usbDevice[reader_index].bus_number;
}

EXTERNAL uint8_t get_ccid_usb_device_address(int reader_index) {
return usbDevice[reader_index].device_address;
}
#endif

/*****************************************************************************
*
* get_ccid_usb_interface
Expand Down
5 changes: 5 additions & 0 deletions src/ccid_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ status_t CloseUSB(unsigned int reader_index);

const unsigned char *get_ccid_device_descriptor(const struct libusb_interface *usb_interface);

#if !defined(TWIN_SERIAL)
uint8_t get_ccid_usb_bus_number(int reader_index);
uint8_t get_ccid_usb_device_address(int reader_index);
#endif

int ControlUSB(int reader_index, int requesttype, int request, int value,
unsigned char *bytes, unsigned int size);

Expand Down
13 changes: 13 additions & 0 deletions src/ifdhandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,19 @@ EXTERNAL RESPONSECODE IFDHGetCapabilities(DWORD Lun, DWORD Tag,
}
break;

#if !defined(TWIN_SERIAL)
case SCARD_ATTR_CHANNEL_ID:
{
*Length = sizeof(uint32_t);
if (Value) {
uint32_t bus = get_ccid_usb_bus_number(reader_index);
uint32_t addr = get_ccid_usb_device_address(reader_index);
*(uint32_t *)Value = ((uint32_t)0x0020 << 16) | bus << 8 | addr;
}
}
break;
#endif

default:
return_value = IFD_ERROR_TAG;
}
Expand Down